Crontab step by step instructions?

Hello, new to Clear Linux and having trouble getting crontab to work. Does anyone have a step by step instruction, from ‘sudo swupd bundle-add cronie’ to having

1 * * * * /home/user/somescript.sh

to work?

Been working on this for hours yet it seems so simple.

1 Like

Hi, let’s suppose you want to run this cron job as a non-root user named USER and here are the steps

  1. Enable cronie with systemctl enable cronie. Thx @lem0nez
  2. So first you need to add the user USER into /etc/cron.allow so if you run cat /etc/cron.allow its output is just one line with the username USER.
  3. Then you can run crontab -l to see the current list of cron job and run crontab -e to edit the list.
  4. Specifically, in your case, you may have
01 * * * * /usr/bin/bash /home/USER/somescript.sh

If you haven’t already, check if systemd units/timers can meet your needs. systemd is already there integrated into the core of CL and can provide a lot of the scheduling capability that is often needed.

Also make sure that cronie service enabled:

systemctl enable cronie
1 Like