Quote:
Originally Posted by Kia
Check if the process is running and / or the port the gameserver is running on is opened (gameserver is online). That's what I did.
|
Now I have 2 scripts - start.sh and stop.sh. The first one start the server, the second one stop the server. When the scripts are executed in terminal in linux, they work correctly.
/bin/sh /home/dido/user/stop.sh
/bin/sh /home/dido/user/start.sh
But in Monit, only the stop script when I press Stop Service works. The start script failed and the output in Monit is "Execution failed" as you can see in the log.
Execution of start.sh:
Code:
[EEST Aug 14 12:32:15] info : 'gameserver' start on user request
[EEST Aug 14 12:32:15] info : monit daemon at 25821 awakened
[EEST Aug 14 12:32:15] info : Awakened by User defined signal 1
[EEST Aug 14 12:32:15] info : 'gameserver' start: /bin/sh
[EEST Aug 14 12:32:18] error : 'gameserver' failed to start
[EEST Aug 14 12:32:18] info : 'gameserver' start action done
Execution of stop.sh:
Code:
[EEST Aug 14 12:53:14] info : 'gameserver' stop on user request
[EEST Aug 14 12:53:14] info : monit daemon at 25821 awakened
[EEST Aug 14 12:53:14] info : Awakened by User defined signal 1
[EEST Aug 14 12:53:14] info : 'gameserver' stop: /bin/sh
[EEST Aug 14 12:53:14] info : 'gameserver' stop action done
Everything seems good in Monit:
Process Name = gameserver
Pid file = /home/dido/user/pid.pid
Monitoring mode = active
Start program = '/bin/sh /home/dido/user/start.sh' timeout 3 second(s)
Stop program = '/bin/sh /home/dido/user/stop.sh' timeout 3 second(s)
Existence = if does not exist 1 times within 1 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert
Pid = if changed 1 times within 1 cycle(s) then alert
Ppid = if changed 1 times within 1 cycle(s) then alert
CPU usage limit = if greater than 50.0% 2 times within 2 cycle(s) then restart else if succeeded 1 times within 1 cycle(s) then alert
System Name = system_debian
Monitoring mode = active
I should notice that if the start script is executed in terminal manual, the server works and Monit see server is running (so everything with the pidfile is correct).