4

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?

  • Once per minute is the finest granularity offered by crond, per crontab(5). – thrig Feb 12 '16 at 19:10
  • sorry I think I mean per minute, not per second as it seems impossible. – laukok Feb 12 '16 at 19:11
  • I can run that cron job in my Ubuntu linux but not on Arch linux that is the only problem. – laukok Feb 12 '16 at 19:12
  • Can you run the script by hand on Arch and Ubuntu both? (i.e., is it only failing when run via cron?) – Eric Renouf Feb 12 '16 at 19:16
  • are you sure that /srv/shiny-system/cron/CPU.R exists and have execute permissions ? Also as which user (root or non-root) are you trying to run this crom job ? – MelBurslan Feb 12 '16 at 19:18
4

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.

  • Cronie doesn't seem to work. I followed Arch Wiki guide and got same problems. Although my cronie.service is running and I made sure my script name doesn't include any spaces, dots... Script won't work with cronie while it works on it's own. So either cronie package is somehow bad or Arch Wiki should be fixed. Here is my pastebin: pastebin.com/gW4tmn86 – 71GA Jun 20 '16 at 22:45
  • sudo EDITOR=nano crontab -e to use nano! – prodigerati Jul 13 '17 at 5:07
-1

e

create a file with you crone task etc. cron.txt

cat cron.txt 0 1 * * * systemctl stop iradio; shutdown -P 0 30 23 * * * systemctl stop clock 34 23 * * * systemctl start clock

then crontab the new file

crontab cron.txt

It seems to be working now.

  • 1
    OP has created a crontab file; their issue is that a cron daemon isn't running to read it. – jasonwryan Jul 17 '16 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.