Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Arch ARM on a PogoPlug and want to execute a file every hour, the file when call directly runs fine (it is executable), for testing the file

/etc/cron.hourly/crontest

contains

#!/bin/bash
date >> /root/log

First I copied it to /etc/cron.daily but it wouldn't run, run-parts --test lists it as valid but nothing shows in the log file, then I created a crontab:

*/5 * * * * /etc/cron.hourly/crontest

To run it every 5 minutes while monitoring the logfile, it doesn't fire.

This is /etc/cron.d/0hourly

# Run the hourly jobs
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
01 * * * * root run-parts /etc/cron.hourly

and

journalctl -u cronie

just returns

-- Logs begin at Wed 1969-12-31 17:00:03 MST, end at Tue 2014-01-28 10:14:12 MST. --

So even though the PogoPlug doesn't have a rtc it has the correct time via ntp. What else can I do to debug cron / get it to run?

I'm tempted to just write a bash script that loops and sleeps x amount of seconds, but I'd rather figure this one out :-)

share|improve this question

migrated from stackoverflow.com Jan 29 '14 at 17:25

This question came from our site for professional and enthusiast programmers.

    
You must have the incrond or some cron daemon running. Basically, it is a process which monitors all the cron files and does something like the script you are tempted to write. Cron has a cost and in some embedded systems, like the PogoPlug, it may not be running. Try ps -ef (maybe just ps with BusyBox) and see if cron is running. – artless noise Jan 28 '14 at 17:56
    
If need be, there's a cleaner way of doing it without cron. – Notlikethat Jan 28 '14 at 20:57
    
ps didn't show any cron entries so I ran crond by hand, is that the correct way to launch it? – gletscher Jan 29 '14 at 2:00

try user crontab -e to configure your cron... it will check your syntax of cron... and it will save cron based on user.. so /var/spool/cron/'user' will be the path

sorry the poor english

share|improve this answer
    
Thank you for the answer, I did use crontab -e and the /var/spool/cron/root file reads */5 * * * * /etc/cron.hourly/crontest – gletscher Jan 28 '14 at 17:42
    
did you tried run cron at shell with -f cron -f and see what happens?.. change the log dir to /tmp too, maybe you have some sort of security app like apparmor – BrenoZan Jan 28 '14 at 18:17
1  
cron -f -bash: cron: command not found – gletscher Jan 28 '14 at 20:02
    
no apparmor or the like, just plain arch arm (alarm) – gletscher Jan 28 '14 at 20:02
up vote 0 down vote accepted

You need to make sure cronie is started. You can do so with the following command:

systemctl start cronie

This command will enable cronie to start on boot:

systemctl enable cronie
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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