My user defined cron job isn't running. I've checked out some answers, like this one, and all these seem to be correct:
- Use the full path to your script in the crontab
- make sure it is executable:
sudo chmod +x my_script
- You got the path to the interpreter wrong in the first line of your script: it should be
#!/bin/bash
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# "sync" is my script, has #!/bin/env bash in first line
* * * * 1 /home/user1/clones/configs/sync && notify-send "executed sync"
0 * * * 1 git -C /home/user1/clones/configs add -A && git -C /home/user1/clones/configs/ commit -m "synced"
I am aware that the file was reloaded after editing using crontab -e
. Output from systemctl status cron
:
Feb 20 09:31:01 code cron[631]: (sm) RELOAD (crontabs/user1)
Feb 20 09:32:01 code cron[631]: (sm) RELOAD (crontabs/user1)
And the grep CRON /var/log/syslog
shows only some commands executed by root:
Feb 20 09:17:01 code CRON[4600]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Feb 20 09:30:01 code CRON[6806]: (root) CMD ([ -x /etc/init.d/anacron ] && if [ ! -d /run/systemd/system ]; then /usr/sbin/invoke-rc.d anacron start >/dev/null; fi)
Any help?