RpR
Legacy Member
Ik heb volgend scriptje geschreven voor mijn .bashrc
Gewoon dat ik weet dat mijn mysql server draait of niet
Nu zou ik normaal dus gewoon:
Mysql [ On ]
of ipv on off moeten krijgen nu krijg ik deze fout:
Iemand een oplossing?
Alvast bedankt.
Gewoon dat ik weet dat mijn mysql server draait of niet
PHP:
function on
{
normale="\033[37;40;0m"
kleur="\033[32;40;1m"
echo -e "[ $kleur ON $normale ]\n"
}
function off
{
normale="\033[37;40;0m"
kleur="\033[31;40;1m"
echo -e "[ $kleur OFF $normale ]\n"
}
# User specific aliases and functions
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
mysql=`mysqladmin -u root -p******* ping`
echo -e -n "Mysql\t\t\t"
if $mysql="mysqld is alive"
then
on
else
off
fi
Nu zou ik normaal dus gewoon:
Mysql [ On ]
of ipv on off moeten krijgen nu krijg ik deze fout:
PHP:
[RpR@localhost ~]$ bash .bashrc
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
Mysql .bashrc: line 27: mysqld is alive=: command not found
[ OFF ]
Iemand een oplossing?
Alvast bedankt.

uwen bash kan executables met vars door elkaar slaan op deze manier.