Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- here im using the linux tool monit to monitor the udp accessibility, if it's closed like a crash without the pid crashing it works well to restart it, so far never got problems with, has always restarted the crashes, posted a bit more infos in the comments here on page 3-2 http://steamcommunity.com/sharedfiles/filedetails/?id=201284083
- basically this is how it looks like for multiple server it monitors
- Code:
- # Settings
- set daemon 30 # check services at 1-minute intervals
- with start delay 30 # optional: delay the first check by 30s.
- set logfile /var/log/monit.log
- # Checks
- check host starbound with address 127.0.0.1
- start = "/usr/sbin/chroot /chroot-starbound /etc/init.d/starbound start"
- stop = "/usr/sbin/chroot /chroot-starbound /etc/init.d/starbound force-stop"
- # Save starbound_server.log
- if failed port 55102 type udp with timeout 5 seconds then exec "/bin/bash -c 'cp -f /chroot-starbound/starbound/starbound_server.log /chroot-starbound/starbound/starbound_server_crashed_$$$(date +%s%N).log'"
- # Restart
- if failed port 55102 type udp with timeout 5 seconds retry 2 then restart
- check host mbwarband with address 127.0.0.1
- start = "/usr/sbin/chroot /chroot-mbwarband /etc/init.d/mbwarband start"
- stop = "/usr/sbin/chroot /chroot-mbwarband /etc/init.d/mbwarband force-stop"
- # Save starbound_server.log
- if failed port 7240 type tcp with timeout 5 seconds retry 2 then restart
- check host mbwarband2 with address 127.0.0.1
- start = "/usr/sbin/chroot /chroot-mbwarband2 /etc/init.d/mbwarband2 start"
- stop = "/usr/sbin/chroot /chroot-mbwarband2 /etc/init.d/mbwarband2 force-stop"
- # Save starbound_server.log
- if failed port 7340 type tcp with timeout 5 seconds retry 2 then restart
- I check udp for Starbound because it does not write an extra log entry in the file from 127.0.0.1 and I checked, when the tcp crashes, udp too
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement