You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i write script for starting/stopping masterha_manager as service in
system(ubuntu)
you advice use nohup or daemontools.
http://code.google.com/p/mysql-master-ha/wiki/Runnning_Background
i decide using nohup
my script looks very simple still
#############
#############
#############
#!/bin/bash
RETVAL=0
do_start() {
echo "Starting"
nohup masterha_manager --conf=/etc/mha_manager/app1.cnf < /dev/null > /home/mha4mysql/app1.log 2>&1 &
RETVAL=$?
echo
return $RETVAL
}
do_stop() {
echo "Stopping"
masterha_stop --conf=/etc/mha_manager/app1.cnf
RETVAL=$?
echo
return $RETVAL
}
do_stop_force() {
echo "Stopping"
masterha_stop --abort --conf=/etc/mha_manager/app1.cnf
RETVAL=$?
echo
return $RETVAL
}
case $* in
start)
do_start
;;
stop)
do_stop
;;
stop_force)
do_stop_force
;;
*)
echo "usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
exit $RETVAL
#############
#############
#############
when i start masterha_manager, i cannot know it starts good or not.
Usually when any daemon starts, it does all checks, then forks and return 0 as
state that all is good. Or other numer when there is an error.
It gives important information about successfull of start
If i start masterha_manager i cannot get any status code, because it doesnt
fork and work in one thread. If i start it with nohup i receive 0. Its nohup
status. Nohup says that it start good and nothing more. It can stop with error
little while, becouse masterha_manager will make checks and find any error.
I would want to get return code from masterha_manager, but cannot now with
nohup.
i think masterha_manager should be able to start as normal daemon with fork. It
should make checks all and fork only when all is good. And when it forks it'd
return 0. In other cases, when any checks were failed, it shouldnt fork and
must return error code.
or how can i write service script?
ps: same thing with masterha_stop: it returns 0 always. Even it cannot find
mha_manager process - it writes about it but anyway return 0;
for example
root@:/home/mha4mysql# ./mha4mysql.servise stop
Stopping
MHA Manager is not running on app1(2:NOT_RUNNING).
root@:/home/mha4mysql# echo $?
0
Original issue reported on code.google.com by [email protected] on 4 Dec 2012 at 2:04
The text was updated successfully, but these errors were encountered:
For checking MHA status codes, there is a utility script masterha_check_status.
I think this will help.
$ masterha_check_status --conf=mha_test.cnf
mha_test is stopped(2:NOT_RUNNING).
$ echo ?
2
Original issue reported on code.google.com by
[email protected]
on 4 Dec 2012 at 2:04The text was updated successfully, but these errors were encountered: