Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Auto Start Channel When Crash

The Dinosaur
Loyal Member
Joined
Jun 29, 2008
Messages
5,028
Reaction score
999
This is pretty easy to do using cron and is already a feature in my repack. If you take a look in my cabal_config.sh (i'm at work and don't have a copy here) there is a "cron restart support" option which creates a cron task in /etc/cron.d, this task runs every 60 seconds and restarts the server process if they have crashed. The cron task is just 1 line of text in a file and you can paste the line directly from cabal_config.sh into a text document called say "chk_cabal" in cron.d.

One thing you should be aware of is that the cron task can cause problems, this cron task is in darkxl's server files and are responsible for a few problems i have seen posted. If you do "service cabal stop" because you want to change server config it will auto restart after a few seconds and depending on how much you changed before it restarts it can lead to all sorts of orphan processes running and "port in use" errors.

If you ever want to stop the server delete the cron task from /etc/cron.d before stopping the service and you won't have the problem. Just remember to re-add the cron task after you have started again.

EDIT: More exact info:

Code:
*/1 * * * * root /home/cabal/check_daemon.sh

Put that in /etc/cron.d/chk_cabal (you will need to create it).
 
Last edited:
Upvote 0
Experienced Elementalist
Joined
Sep 8, 2008
Messages
213
Reaction score
17
ok sir chump i will check it thanks i will be back here if i have a problem

#!/bin/sh

daemons=`cat /etc/cabal/server_list | grep -v ^#`
logfile=/home/cabal/check_daemon.log

for daemon in $daemons; do
#echo "`date`: check $daemon" >> $logfile
ret=`ps aux | grep $daemon | grep ^cabal | grep -v grep`
if [ -z "$ret" ]; then
echo "`date`: $daemon starting" | tee -a $logfile
/sbin/service $daemon start
fi
done



sir i paste that to chk_cabal in cron.d but seems didnt work everytime my channel crash it didnt start the service
should this script also have a service? i think the script is not running how to automatic start this thanks in advance sir
 
Last edited by a moderator:
Upvote 0
The Dinosaur
Loyal Member
Joined
Jun 29, 2008
Messages
5,028
Reaction score
999
The code you have pasted there is /home/cabal/check_daemon.sh. What you should have in chk_cabal is the line i posted in my last edit, that calls /home/cabal/check_daemon.sh to check if the service is running and restart it if not. It should look like this:

/etc/crond/chk_cabal ...
Code:
*/1 * * * * root /home/cabal/check_daemon.sh

/home/cabal/check_daemon.sh ...
Code:
#!/bin/sh

daemons=`cat /etc/cabal/server_list | grep -v ^#`
logfile=/home/cabal/check_daemon.log

for daemon in $daemons; do
#echo "`date`: check $daemon" >> $logfile
ret=`ps aux | grep $daemon | grep ^cabal | grep -v grep`
if [ -z "$ret" ]; then
echo "`date`: $daemon starting" | tee -a $logfile
/sbin/service $daemon start
fi
done
 
Upvote 0
The Cat in the Hat
Legend
Joined
Oct 26, 2005
Messages
4,475
Reaction score
677
I should have watched my mouth and not said/talked poop to DeadlyData telling him things like your are not welcome here because then I become the one who is truly not welcome here.
 
Upvote 0
Experienced Elementalist
Joined
Sep 8, 2008
Messages
213
Reaction score
17
sir chump i already did that but seems its not working everytime the channel crush it didnt restart

[root@cabal ~]# service chk_cabal status
chk_cabal: unrecognized service
[root@cabal ~]#


sir cyph sorry for the double post i already edit my post i dont know what happen
 
Upvote 0
Experienced Elementalist
Joined
Sep 8, 2008
Messages
213
Reaction score
17
[root@cabal ~]# cd /etc/init.d
[root@cabal init.d]# $daemon start
-bash: start: command not found
[root@cabal init.d]# service $daemon start
start: unrecognized service
[root@cabal init.d]#

stil not work >.<
 
Upvote 0
The Dinosaur
Loyal Member
Joined
Jun 29, 2008
Messages
5,028
Reaction score
999
sir chump i already did that but seems its not working everytime the channel crush it didnt restart

[root@cabal ~]# service chk_cabal status
chk_cabal: unrecognized service
[root@cabal ~]#


sir cyph sorry for the double post i already edit my post i dont know what happen

"chk_cabal" is not a service it is a cron task so running it manually like that won't work. If you want to run the check manually run /home/cabal/check_daemon.sh, it should check the services and restart any that have stopped.

Also check permissions on /etc/cron.d/chk_cabal and /home/cabal/check_daemon.sh to make sure they are set to 0777 or they may fail to run due to permissions.
 
Upvote 0
Newbie Spellweaver
Joined
Apr 7, 2007
Messages
77
Reaction score
1
my serve after the login fix did not work over the controls.

WorldSvr_24_01 service start / stop / restart / status

someone knows fix this?
 
Upvote 0
Back
Top