ok i know that crontab can be used to execute scripts at a set time or every x minutes....i can find loads of stuff about that but its the scripts i cant figure out
heres what i want it for
we use ubuntu and run a minecraft server (using craftbukkit)
our procedure is to load it into a screen so we can have remote access to it
all that works really well and ubuntu is wonderfully stable for it
but we need to do two things
1) every 30 minutes we need a script to:
- gointo the screen ( screen -dr xxxx where xxxx seems to be a random number)
- enter the following text into the screen as though it was typed save-all (ENTER KEY)
2) at 0550 every day we need a script to:
- gointo the screen ( screen -dr xxxx where xxxx seems to be a random number)
- enter the following text into the screen as though it was typed say server going down in 10 minutes {ENTER KEY)
- sleep 60
- enter the following text into the screen as though it was typed say server going down in 9 minutes {ENTER KEY)
- sleep 60
- ...so on till it gets to 0
- enter the following text into the screen as though it was typed stop {ENTER KEY)
- sleep 300
- enter ./start.sh
now as you can see i know the wait command is sleep n (amount of seconds)
but the screen is always a random number which means any script has to have the new number entered (theres got to be an easier way).
since when you go into the screen its the console not a proper terminal session (you just type into it the same as a terminal) i dont even know if what im asking can be done
**side note**
there are tons of plugins for the software to do the save-all bit ...but as new builds are appearing weekily sometime daily lol these get broken, and a plugin uses resources, spams the console and is yet another plugin to look at when stuff goes wrong, i think crontab would be a more sensible route
thnx in advance