Can't get my cron job to run

Hey guys, i’m new to the forum and new to manjaro and linux in general.
Hope this is the right place to post my question.

I have a problem getting my cron jobs to run and i can’t figure out why.
I set up everything like in this tutorial:
archived.forum.manjaro(dot)org/t/how-to-create-a-cron-job-in-manjaro/105
(it won’t let me post a link, sry)

this is my file structure:

[...@...-pc ~]$ ls /etc/cron*
/etc/cron.deny

/etc/cron.d:
mycronjobs

/etc/cron.daily:

/etc/cron.hourly:
0anacron

/etc/cron.minutely:
sortFiles

/etc/cron.monthly:

/etc/cron.weekly:

The mycronjobs file looks like this:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

*/1 * * * * root run-parts /etc/cron.minutely #Runs a cron job script every minute
01 * * * * root run-parts /etc/cron.hourly #Runs a cron job script every hour
02 4 * * * root run-parts /etc/cron.daily #Runs a cron job script every day
22 4 * * 0 root run-parts /etc/cron.weekly #Runs a cron job script every week
42 4 1 * * root run-parts /etc/cron.monthly #Runs a cron job script every month

The "sortFiles" file (which i want to run) looks like this:
mv /home/.../Downloads/*.nzb /var/snap/sabnzbd/common/nzbs \;
find /var/snap/sabnzbd/common/Downloads -maxdepth 1 -mindepth 1 ! \( -name "incomplete" -o -iname "_unpack_*" -o -iname "_failed_*" \) -exec mv {} /home/.../Downloads/ \;

If i run these commands from the terminal they work, but it won’t run automatically.

journalctl -xb -u cronie

gives the output:

-- Journal begins at Fri 2021-06-04 13:07:52 CEST, ends at Sat 2021-09-18 11:02:01 CEST. --
Sep 18 10:16:00 ...-pc crond[713]: (CRON) STARTUP (1.5.7)
Sep 18 10:16:00 ...-pc crond[713]: (CRON) INFO (Syslog will be used instead of sendmail.)
Sep 18 10:16:00 ...-pc crond[713]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 84% if used.)
Sep 18 10:16:00 ...-pc crond[713]: (CRON) INFO (running with inotify support)
Sep 18 10:16:00 ...-pc systemd[1]: Started Periodic Command Scheduler.
░░ Subject: A start job for unit cronie.service has finished successfully
░░ Defined-By: systemd
░░ Support: ...
░░  
░░ A start job for unit cronie.service has finished successfully.
░░  
░░ The job identifier is 132.
Sep 18 10:17:01 ...-pc CROND[2031]: (root) CMD (run-parts /etc/cron.minutely #Runs a cron job script every minute)
Sep 18 10:17:01 ...-pc CROND[2030]: (root) CMDEND (run-parts /etc/cron.minutely #Runs a cron job script every minute)

and

systemctl status cronie

shows

● cronie.service - Periodic Command Scheduler
     Loaded: loaded (/usr/lib/systemd/system/cronie.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2021-09-18 10:16:00 CEST; 49min ago
   Main PID: 713 (crond)
      Tasks: 2 (limit: 38451)
     Memory: 1.1M
        CPU: 771ms
     CGroup: /system.slice/cronie.service
             ├─ 713 /usr/bin/crond -n
             └─3529 /usr/sbin/anacron -s

Sep 18 11:01:01 ...-pc anacron[3529]: Will run job `cron.daily' in 15 min.
Sep 18 11:01:01 ...-pc anacron[3529]: Jobs will be executed sequentially
Sep 18 11:02:01 ...-pc CROND[3538]: (root) CMD (run-parts /etc/cron.minutely #Runs a cron job script every minute)
Sep 18 11:02:01 ...-pc CROND[3537]: (root) CMDEND (run-parts /etc/cron.minutely #Runs a cron job script every minute)
Sep 18 11:03:01 ...-pc CROND[3551]: (root) CMD (run-parts /etc/cron.minutely #Runs a cron job script every minute)
Sep 18 11:03:01 ...-pc CROND[3550]: (root) CMDEND (run-parts /etc/cron.minutely #Runs a cron job script every minute)

For me it looks like everything is running, can somebody help me?
Thank you!

This file disallows you to use cron as non-root user. You need to create /etc/cron.allow file with your username.

1 Like

Thanks, but the script should run as root, so i don’t need that.

I actually just figured out it wasn’t running, because the script didn’t have the execute permission.
So this is solved…
I would delete the post, but i don’t see how.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.