Score:2

jobs not running cron ubuntu20.04

mx flag

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?

Score:3
mx flag

The problem is this instruction:

 * * * * 1

That will only run first day of the week. Now I just tested with

 * * * * *

And will end up using

 0 * * * *
pa4080 avatar
cn flag
There is available a plenty of tools like this one: https://crontab.guru/
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.