Jump to content
Hak5 Forums
lasermole

Cron reboot command?

Recommended Posts

Hi all,

Just got a LT last week, and liking it so far. Though my plan for it requires it be placed in a remote location I can't get into without some effort.

That said I want to use cron to reboot the LT on a time schedule, either a specific time say 1AM EST, or after a certain amount of uptime.

I've had no luck with the entries I've made into cron so far.

ex.

0 1   *   *   *    root reboot > /dev/null 2>&1
0 1   *   *   *    /sbin/reboot

 

If anybody can help me find a working cron reboot setup I'd be so very grateful!

 

Thanks!

lasermole.

 

Share this post


Link to post
Share on other sites

It's possible, but the LT has to have some kind of server to refer to so that it can know what the time is, otherwise it will get confused about what the time is.

That said, I haven't had much experience with an LT...

Share this post


Link to post
Share on other sites

well from what I can tell the turtle uses NTPD and gets a accurate time after booting up.

At this point I just want to know what correct command to input into cron to trigger a reboot? even if it happens at the wrong time, it'd be something.

lasermole

Share this post


Link to post
Share on other sites

Alright I got it working.

NTP gets an accurate time.

Though I had to edit /etc/config/system

and change it to my time zone. As referenced at openwrt wiki

---------------------------------------------------------------------------

config system
       option timezone 'EST5EDT,M3.2.0,M11.1.0'
       option hostname 'turtle'

config timeserver 'ntp'
       list server '0.openwrt.pool.ntp.org'
       list server '1.openwrt.pool.ntp.org'
       list server '2.openwrt.pool.ntp.org'
       list server '3.openwrt.pool.ntp.org'
       option enabled '1'
       option enable_server '0'

config led 'led_wan'
       option name 'WAN'
       option sysfs 'turtle:yellow:system'
       option trigger 'netdev'
       option dev 'eth1'
       option mode 'link tx rx'

--------------------------------------------------------------

Then I also took a page from their wiki noting how to perform automatic reboots.

So I edited my crontab to this: (will reboot automatically at 4:30AM)

-----------------------------------------------------------------------

30 4 * * * sleep 70 && touch /etc/banner && reboot

------------------------------------------------------------------------

And this worked perfectly!

Hope this helps someone else too. I just can't be totally trusting of the turtle's reliability in the case of some lock up, or what not. So this will give me a chance to have it reboot nightly and re-connect if possible.

 

Thanks all.

lasermole

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×