Openwrt, rdate, and cron

I’m a stickler about having the right time on all my machines. I usually use ntp but rdate is included with openwrt so that’s what I use on my router. The first thing I needed to set was the time zone. This is done via the environment variable TZ. I put the following in /etc/profile:

TZ="EST5EDT"

I like to have my time updated each day so I added the following to my crontab:

0 0 * * * /usr/sbin/rdate 128.138.140.44

Finally, I had to enable crond so I created /etc/init.d/S51crond which contains:

#!/bin/sh
# start crond
/usr/sbin/crond -c /etc/spool/cron/crontabs

Having the spool directory under etc preserves changes over reboots.

Advertisements
This entry was posted in Geek. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s