OpenWrt Forum Archive

Topic: crontab issues

The content of this topic has been archived on 7 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi guys,

I'm trying to edit my crontab with the -e flag and I'm getting an error:

root@OpenWrt:~# crontab -e
crontab: cannot change dir to /var/spool/cron/crontabs: No such file or directory

The crond has been started with /etc/contabs in mind

root@OpenWrt:~# ps -ef | grep crond
  431 root        392 S   crond -c /etc/crontabs

The permissions seems right

root@OpenWrt:~# ls -l /etc | grep crontabs
drwxr-xr-x    1 root     root            0 Jan  1 21:24 crontabs

root@OpenWrt:~# ls -l /etc/crontabs/
-rw-------    1 root     root            0 Jan  1 21:24 root

Since /var is a symlink to /tmp, this /var/spool/cron would be flushed at reboot, am I right ?

I am wondering if the /var/spool/cron is a parameter specified during compilation. Is there a way the developpers could make that path point to a permanent location ?

Thanks for your help, it's greatly appreciated!

I can't reproduce your problem here. Which version of OpenWrt are you using?

I followed the HowtoEnableCron Wiki page and it works for me including "crontab -e".

(Last edited by olli on 10 Feb 2006, 12:42)

AFAIK, there's nothing magical about 'crontab -e'.

Why not just edit the /etc/crontab file directly?
ie:

vi /etc/crontab


As always, make a backup first :-)

try -c option to specify directory for crontabs dir.

root@ap51:~# ps -aef | grep cron
  552 root        392 S   /usr/sbin/crond -c /etc/crontabs
1224 root        304 S   grep cron
root@ap51:~#

if works fine for me. I don't know why not for you ... ?

(Last edited by _marc_ on 10 Feb 2006, 19:56)

I see this an oversight in the porting. Probably worth filing a low-priority bug-report.

I've just been symlinking one to the other, because I am in the habit of using crontab -e from other systems and having to remember that I vi  /etc/crontab instead on this box is annoying.

Oooh, good find, thanks. That script fixes things nicely.

Just do what I did, very simple, straightforward:

mkdir /etc/crontabs
cd /etc/init.d
cp S60cron S60cron.t
rm S60cron
mv S60cron.t S60cron
vi S60cron

Original file:
#!/bin/sh
[ -d /etc/crontabs ] && crond -c /etc/crontabs

And I added a couple lines so that it looks like this:
#!/bin/sh
mkdir -p /var/spool/cron
ln -s /etc/crontabs /var/spool/cron/
[ -d /etc/crontabs ] && crond -c /etc/crontabs

The discussion might have continued from here.