Quantcast
Channel: Linux – Xeo
Viewing all articles
Browse latest Browse all 6

Check moodle web login script

$
0
0

This is a general problem that how you will check moodle login with a script. I have written a custom script which I want to share with you that helps us check the login in moodle and escalate it via Nagios in case it fails. Now the question arises why I want to check moodle login. The answer is as simple as to make sure all the service moodle require to function properly are working fine like (mysql, ldap, webserver). Please find the script below to check the moodle login

#!/bin/sh
#usage sh script server userid password
# sh x moodle.example.com user password
chklogin=”
URL=$1
username=$2
password=$3
cookies=$4
rm -f /tmp/${4}*.txt
curl -b /tmp/$i{4}.txt -c /tmp/$4.txt http://${1}/moodle/login/index.php &>/dev/null
curl -b /tmp/$4.txt -c /tmp/$4.txt -d “username=$2&password=$3” http://$1/moodle/login/index.php &>/dev/null
chklogin=`curl -b /tmp/${4}.txt -c /tmp/${4}.txt -d “username=${2}&password=${3}” http://${1}/moodle/index.php 2>/dev/null | grep “You are logged in as”`
p=`echo $chklogin | awk -F “>” ‘{ print $3 }’ | awk -F “


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images