Tag: crontab

  • Backup your Crontab …

    Yesterday evening I just quickly wanted to change something in my crontab .. I was tired, I was distracted, I just SSH’ed into my machine and typed crontab -r.

    Ahh typo! I obviously wanted to crontab -e which is just ONE key away from -r. But … no error, no “unknown option”? This left me in a “eh what is -r and why is crontab -l empty?” – and I sensed a little disaster …

    A quick check with man crontab confirmed my discovery:

           -r     Removes the current crontab.

    Oh man. I never thought about backing up my crontab! Until yesterday. Now I have a fresh crontab and new line in in it, too:

    crontab -l > crontab.bak && git commit -am "auto commit" && git push

    Luckily there wasn’t TOO much in my crontab, but still, this was an anooying experience. Maybe there are smarter ways to backup scripts in my home directory – but it’s okay for now.

    Fediverse Reactions