Linux – Arch Linux – How to run a cron job

arch linuxcron

I am on Arch Linux and I'm trying to make a cron job that fires every minute. So I use:

$ crontab -e

And add the script in:

* * * * * Rscript /srv/shiny-system/cron/CPU.R
~
~
"/tmp/crontab.8VZ7vq" 1 line, 47 characters 

(I have no idea what that "/tmp/crontab.8VZ7vq" is!)

But it is not working – CPU.R is not running every minute. What should I do then in Arch Linux to run the cron job? I have looked into these wiki guides below but I am still lost:

Edit

I found some hints from here regarding crond.

[xxx@localhost ~]$ systemctl status crond
● crond.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
[xxx@localhost ~]$ sudo systemctl start crond
[sudo] password for xxx: 
Failed to start crond.service: Unit crond.service failed to load: No such file or directory.

What does this mean? Where should I put this crond.service and what script should I put in it?

Best Answer

There is no crond.service on Arch Linux. As the Arch Wiki makes perfectly clear:

There are many cron implementations, but none of them are installed by default as the base system uses systemd/Timers instead.

Consequently, if you want to use cron, you have to choose which of the many implementations you will install, and then start that specific service.

You don't just randomly type systemctl enable nonexistent.service and then wonder why it isn't running...

If you want cronie, then you install cronie and start it with:

pacman -Syu cronie
systemctl enable --now cronie.service

The Arch documentation is generally very clear; if you read the pages you linked to more carefully, you should find out what you need.

Related Question