Mon, 28 Jun 2010
Keywords: linksys wrt54g router alchemy
Every so often my Linksys WRT54G router will stop accepting connections. The simplest solution is just to reboot it. The trouble occurs when that happens and I am not near the router. So I wanted to set up a cron job to reboot it every night.
ssh into the router and run these commands:
nvram set rc_startup='#!/bin/sh echo "0 5 * * * root /sbin/reboot" > /tmp/cron.d/reboot touch /tmp/crontab ' nvram commit nvram get rc_startup
The first four lines set up a startup command which writes the cron line after each reboot, and touches the crontab to get cron to reload. The fifth line commits the command to the nvram and the final command simply prints it out to check.