[Voyage-linux] $SELF variable during executing mysql script on shutdown
Adam Mazurkiewicz
(spam-protected)
Sun Sep 4 10:16:29 HKT 2011
I am trying to use this script on voyage-linux rev. 7.5
http://www.3open.org/d/voyage/mysql-init
This script was written for voyage-linux 6.2
It does not work properly on 7.5 release in 'stop') section when
rebooting at shutdown process. I mean this part:
'stop')
# * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
# at least for cron, we can rely on it here, too. (although we have
# to specify it explicit as e.g. sudo environments points to the normal
# users home and not /root)
# if called from system shutdown or reboot, do db backup first
set +e
echo $SELF | egrep -q "rc[06].d"; r=$?
if [ "$r" = "0" ] ; then
log_progress_msg "Backing up all db "
/usr/local/bin/backup-mydb.sh
fi
It does not execute this command:
/usr/local/bin/backup-mydb.sh
The reason I find out is that the global variable $SELF is actually
/etc/init.d/mysql
since the script is expecting the value that contens rc0.d or rc6.d.
See that line:
echo $SELF | egrep -q "rc[06].d"; r=$?
Well the question is why the $SELF variable has such a value and how
to change the code to work properly? It should execute the
backup-mydb.sh program if called from system shutdown or reboot.
Regards
More information about the Voyage-linux
mailing list