←  The Lounge

Forums

»

Cron to update time - at boot and every day

fced's Photo fced 18 Jun 2012

Hello,
My dm500 with Openpli is disconnected from satellite so time is not correct...
Actually i update it manually with date command : date -s 2012.06.18-18:58:00

I would like to create a script (cron script) to update time during the boot (before other services start) and each day ...
For this, i have enabled Cron from DM500 -> System Setting -> Services
and i tried to create my cron script :

On the DM500 by telnet i typed crontab -e :
then i entered my script (to update time at each minute - just to see if it work) :
1 * * * * /sbin/rdate -s time.mit.edu
After this, i have found a new file (crontab.273) in /var/spool/cron with my command inside...

but nothing appear, no time update... nothing...
I tried also to duplicate the file to /var/spool/cron/crontab
i also renamed my file in "root" but nothing

Any idea please ?

Can someone help me please ?
Thankyou
Ced
Quote

mirakels's Photo mirakels 18 Jun 2012

1 * * * * will run your command every hour!
to get it once a day it must be something like "1 1 * * * command"


You should indeed have a file /var/spool/cron/crontabs/root containing your crontab entry.

Did you check if crond is running (check output of ps command?
Quote

fced's Photo fced 20 Jun 2012

Hello,
May be crond is not running...
- How can i check if crond is running (i have enabled it from system setting->Services) - it's not visible in top command
- If i want to run a script at boot (before softcam stard), where should i put it ? - I want to execute this command rdate -s tick.greyware.com at boot, and every day...

ps : strangely, when i type crontab -e it create a file in : var/spool/cron not in var/spool/cron/crontabs...
Is this normal ?

when i type : "crontab" i get :

root@dm500 ~ # crontab
BusyBox v1.01 (2011.08.18-03:38+0000) multi-call binary

Usage: crontab [-c dir] {file|-}|[-u|-l|-e|-d user]
Edited by fced, 20 June 2012 - 23:35.
Quote