You are not logged in.

#1 2025-04-06 14:00:03

m3nhir
Member
From: Torino - Italy
Registered: 2020-04-03
Posts: 46

[SOLVED] crontab not working

hi at all,
I have a problem with crontab. It does not run the script inside it. I created the crontab with the command

crontab -e

.
If I give

crontab -l

it displays the content correctly.
This is my crontab:

#
@reboot /home/sergio/restic_link.sh
#
# runs the script every 2 hours
* */2 * * * /home/sergio/restic_link.sh
#

If I manually run the script, it works.
Where am I going wrong?
Thanks.

Last edited by m3nhir (Yesterday 12:24:57)


Intelligence is not making mistakes, but find out how to profit immediately.

Offline

#2 2025-04-06 14:47:28

mackin_cheese
Member
Registered: 2025-01-07
Posts: 390

Re: [SOLVED] crontab not working

do you get an error?

Offline

#3 2025-04-06 19:20:56

m3nhir
Member
From: Torino - Italy
Registered: 2020-04-03
Posts: 46

Re: [SOLVED] crontab not working

mackin_cheese wrote:

do you get an error?

no, no error. The script simply does not run. The script only needs to generate a link to an executable to make it work properly.


Intelligence is not making mistakes, but find out how to profit immediately.

Offline

#4 2025-04-06 20:35:44

seth
Member
Registered: 2012-09-03
Posts: 62,433

Re: [SOLVED] crontab not working

Is your verification test the 2h frequency or the @reboot?

What does the script look like?
Why is there a script if it's basically just "ln -s whatever somewhere"?
The script is executable?

If you extend it w/ "date >> /tmp/proof", does /tmp/proof also not show up after it was supposed to execute?

Finally:
Please post the output of

find /etc/systemd -type l -exec test -f {} \; -print | awk -F'/' '{ printf ("%-40s | %s\n", $(NF-0), $(NF-1)) }' | sort -f

(ie. "cronie is enabled, is it?")

Offline

#5 Yesterday 12:24:05

m3nhir
Member
From: Torino - Italy
Registered: 2020-04-03
Posts: 46

Re: [SOLVED] crontab not working

Thanks for the reply.
In fact the problem was the "cronie" service that was disabled by default. I had not checked because I always assumed that cron was always enabled on Linux systems.
after enabling "cronie.service" the crontab works and runs the script.
Thanks again for the help.


Intelligence is not making mistakes, but find out how to profit immediately.

Offline

Board footer

Powered by FluxBB