Hi guys, I would say I'm a very n00 n00b to linux in general and I'm currently scratching my head rather vigorously (and have been for the last 3 hours) about crontab.
Here's my setup (probably completely irrelevant but hey):
I have an old desktop PC (a box with a brain) whose sole purpose is to host 2 Minecraft servers (which it does admirably). It has no monitor or keyboard, so I use SSH from another computer.
What I'm trying to achieve:
I'm trying to use crontab to make a backup of the servers at 4:00 am everyday. It would do this by copying the parent folders (creative-server and survival-server) to a folder named with the date-stamp. It would look something like this:
The crontab file:
I installed crontab using pacman:
When I edit the crontab file from root (everything I have done is from root), either by viewing it with
or editing it with
this is what I have:
The issue I'm having:
Having created that crontab file I set it to run at the next minute (eg at 18:50 I would use "51 18 * * *" to execute next minute). But it didn't run. I'm not sure whether it's because it didn't run at all or if it hit an error as I didn't get any feedback at all. I checked that the command worked, then tried with other commands like:
and that didn't work either.
Hopefully some infinitely more experienced person can help; I would be very grateful!
If you want me to post any other info, please let me know! (As I said I'm a n00b here; this is my first ever post to a forum )
Thank you very much!
Here's my setup (probably completely irrelevant but hey):
I have an old desktop PC (a box with a brain) whose sole purpose is to host 2 Minecraft servers (which it does admirably). It has no monitor or keyboard, so I use SSH from another computer.
What I'm trying to achieve:
I'm trying to use crontab to make a backup of the servers at 4:00 am everyday. It would do this by copying the parent folders (creative-server and survival-server) to a folder named with the date-stamp. It would look something like this:
The crontab file:
I installed crontab using pacman:
Code:
pacman -S cronie
When I edit the crontab file from root (everything I have done is from root), either by viewing it with
Code:
crontab -l
Code:
crontab -e
Code:
0 4 * * * cd /home/dapeef/minecraft/1.13 && mkdir Backups/$(date "+\%Y-\%m-\%d") && cp -r current_servers/creative-server Backups/$(date "+\%Y-\%m-\%d") && cp -r current_servers/survival-server Backups/$(date "+\%Y-\%m-\%d")
The issue I'm having:
Having created that crontab file I set it to run at the next minute (eg at 18:50 I would use "51 18 * * *" to execute next minute). But it didn't run. I'm not sure whether it's because it didn't run at all or if it hit an error as I didn't get any feedback at all. I checked that the command worked, then tried with other commands like:
Code:
mkdir /home/dapeef/TEST
Hopefully some infinitely more experienced person can help; I would be very grateful!
If you want me to post any other info, please let me know! (As I said I'm a n00b here; this is my first ever post to a forum )
Thank you very much!