Arch cron
- TIL Arch has no cron by default, and uses systemd timers1.
- cron - ArchWiki
sudo pacman -S cronie
sudo systemctl enable cronie.service
# many minutes were lost due to me forgetting to start it as well...
sudo systemctl start cronie.service
- I like this website to generate stuff:Crontab Generator - Generate crontab syntax
- cronie - Timed Tasks - Documentation as good as any
- the script has to be executable
crontab -e
edits your own crontab, then you can omit the username.
Cron git backup script
#!/bin/bash
# https://stackoverflow.com/posts/1482133/
# get the directory where this file is located
DIRNAME="$( dirname -- "$( readlink -f -- "$0"; )"; )"
cd $DIRNAME &&
git add -A &&
git commit -m "Automatic backup at `date`" &&
git push origin master &&
echo "Done"
# and this is the crontab
# odd hours:
# * 1-23/2 * * * /bin/bash $HOME/this-script-location.sh > /tmp/cronlog
EDIT: sometimes if git crashes an index file stays and then nothing runs — so the cronjob must be somehow monitored manually, todo.
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus