Cronjob help please
-
- This is my homepage
- Posts: 157
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Mon Jul 07, 2008 1:47 pm
Cronjob help please
What would I put in crontab -e if I wanted it to run a script in /home/jordon/minecraft every day at 10am and 10pm central time. Thanks all!
Re: Cronjob help please
0 10/20 * * * /home/jordon/minecraft/yourscript
Re: Cronjob help please
Thanks, and if I had one to run every hour? (world backup script)
Re: Cronjob help please
0 * * * * /home/jordon/minecraft/yourscript
Wikipedia has a pretty good treatment of how crontabs work here: http://en.wikipedia.org/wiki/Cron
Wikipedia has a pretty good treatment of how crontabs work here: http://en.wikipedia.org/wiki/Cron
Re: Cronjob help please
For some reason the server isn't up when I wake up. It's like its running the script but doesn't bring it back up. But I don't think that's it because just running it myself works fine.
Any ideas on why it's never up in the morning? I'm running Ubuntu 10.04 with Bukkit and one plugin.
Code: Select all
#!/bin/bash
/usr/bin/screen -x minecraft -X -p0 stuff "`printf "say Server is
restarting in 60 seconds\r"`"
/bin/sleep 29
/usr/bin/screen -x minecraft -X -p0 stuff "`printf "say Server is
restarting in 30 seconds\r"`"
/bin/sleep 24
/usr/bin/screen -x minecraft -X -p0 stuff "`printf "say Server is
restarting in 5 seconds\r"`"
/bin/sleep 1
/usr/bin/screen -x minecraft -X -p0 stuff "`printf "say Server is
restarting in 4 seconds\r"`"
/bin/sleep 1
/usr/bin/screen -x minecraft -X -p0 stuff "`printf "say Server is
restarting in 3 seconds\r"`"
/bin/sleep 1
/usr/bin/screen -x minecraft -X -p0 stuff "`printf "say Server is
restarting in 2 seconds\r"`"
/bin/sleep 1
/usr/bin/screen -x minecraft -X -p0 stuff "`printf "say Server is
restarting in 1 seconds\r"`"
/bin/sleep 1
/usr/bin/screen -x minecraft -X -p0 stuff "`printf "stop\r"`"
/bin/sleep 10
/usr/bin/screen -fa -d -m -S minecraft /usr/bin/java -server -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:ParallelGCThreads=2
-Xnoclassgc -Xmx2816M -Xms2816M -jar Minecraft_Mod.jar nogui
Re: Cronjob help please
It looks like you need to add to your script a "cd" at the beginning to change to the directory of your Minecraft installation.
Re: Cronjob help please
so like this
Code: Select all
cd minecraft
the rest of the script
Re: Cronjob help please
after the bin/bash of course
Re: Cronjob help please
Yes, but you should probably make it absolute. "cd /minecraft" or whatever the full path is to your Minecraft folder.
Re: Cronjob help please
Adding the cd /path/to/script/location seems to have fixed it, thanks!