ID:1065597
 
Im not very experienced with cron scrips and want to know if this Script will reboot my game every 45 minutes.

#!/bin/bash for t in {1..12} do if [ -z "$(ps -C DreamDaemon | grep DreamDaemon)" ] then killall -v DreamDaemon /usr/local/bin/DreamDaemon "/root/byond/AOP/One Piece.dmb" 5555 -trusted & fi sleep 2700 exec $0 done
Instead of making the script sleep etc why not run it every 45 minutes using cron?

You can use this website to figure out the times you need to use http://cronwtf.github.com/

It'll be sOmething like 45 * * * * COMMAND

Runs `COMMAND` at minute :45, every hour.
Im not familiar which linux version you are running, however i do see that you are using the kill all command. As far as rebooting the server, there should be a reboot or Restart command that you can use for dreamdaemon itself. If you are worried about crashes where dreamdaemon is still running but the game is non-functional, the kill all command might be a good option.

But more so on the restarting of your server, I dont see the execution of the dreamdaemon client with the proper arguments. Are you currently experiencing trouble with the restarts? If the process is being killed, but the dreamdaemon isnt launching afterwards, then its simply as you are concerned, not restarting or 'rebooting'.

For ubuntu systems there is a crontab file that you can access to schedule tasks for repeated execution, and as Undefeated Saiyans has mentioned the settings there are what you are looking for. However I would use the */45 on the minutes line to execute the script every 45 minutes, and * on each other like he suggested to have it repeated every 45 minutes of every hour day, day of week, week and month.