2

I have a computer with Ubuntu server 15.10 installed on it that sits in the same room I am in. I use it just as a Minecraft server, map renderer and whatever else php scripts I want to run scheduled within my house. I have a few cronjobs set up to render map at 3am, back up game server at 2am, restart Minecraft if server dies (cron runs every minute and checks if the process is running, if not starts it). All this works great, except for the fact my crontab disappears after a day or so.

I am setting it on my regular user account I login with (some of the things don't run when running as root). I edit it with crontab -e which opens in vim. I can list it with crontab -l, I even tried resetting it with crontab -r and manually adding my lines again at the bottom but whatever I do it reverts back to a single line I entered ages ago which I now don't even want running.

Any idea what could be causing this?

  • in your backup job, do you have a command that mirrors in a wrong direction? – syss Mar 7 '16 at 10:37
  • is there a root-owned crontab that's resetting it? Does it revert back immediately, or on a particular schedule? – Jeff Schaller Mar 7 '16 at 12:02
  • @syss I don't 100% know what that means, but it runs a few scripts which I wrote just to execute a few things. Does not attempt to alter crontab at all though. – Brad Moore Mar 7 '16 at 12:57
  • @JeffSchaller, root crontab is empty (well just default comments). Does not revert back immediately, I have not narrowed down yet the time it happens. Normally its when a friend messages me saying Minecraft sever crashed again, and then I wonder why my startup script did not work and I check cron and its gone. I checked just now, rather than replacing my 4 lines with the 1 that it was doing previously it instead appended that 1 old line about 25 times. That is a new one... – Brad Moore Mar 7 '16 at 13:00
  • You should edit the new information into your question, on the assumption that you have just one issue going on! I wonder now if someone else has root access to your system. One idea to narrow down the timeframe would be to write an every-minute cron job to update a file, then see when that file stops updating. – Jeff Schaller Mar 7 '16 at 13:37
0

The problem came from this Minecraft backup script. It was set to create the cronjob itself but it would just wipe the entire crontab for whatever reason. Reporting it on their issue tracker.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.