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
- Enable
cronie
with systemctl enable cronie
. Thx @lem0nez
- 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
.
- Then you can run
crontab -l
to see the current list of cron job and run crontab -e
to edit the list.
- 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