Koozali.org: home of the SME Server

Automatic reboot

Will

Automatic reboot
« on: February 25, 2003, 02:31:37 AM »
hi - Is there a way that i can get e-smith to automaticly reboot at about 2am every sunday morning or every 7 days?

Dave Liquorice

Re: Automatic reboot
« Reply #1 on: February 25, 2003, 04:14:17 AM »
A cron event that issues a "shutdown  -r now" strikes me as the easy way but I have to ask  why do you want to reboot every 7 days? My linux box is currently at 66 days, 15:54 with not a glitch,. Admitdely this isn't an SME box but an ancient v6.1 SuSE box. (Don't worry it's not "accessable".)

Kelvin

Re: Automatic reboot
« Reply #2 on: February 25, 2003, 02:15:13 PM »
Cron Event - Yes.

But I think, under SME, it might be more inline with SME itself to call

/sbin/e-smith/signal-event reboot

instead.

Don't really know if it makes any difference though. Just in case signal-event reboot performs some clean up / cleardown operations that shutdown -r does not (but again, I don't know if it does or not).

Kelvin

Dave Liquorice

Re: Automatic reboot
« Reply #3 on: February 25, 2003, 04:33:26 PM »
Given the choice I'd use the SME way.  I don't know if it does anything "special" but as it exists one may as well use it.

Cheers
Dave.

Will

Re: Automatic reboot
« Reply #4 on: February 26, 2003, 12:29:51 AM »
I am looking at using the sme reboot option but what i'm really looking for is how to tell the computer to preform that task every 7 days? I'm not that good with scripting in linux. Why i reboot every 7 days is because a new "packet" is sent to each machine within the 1st hour of the 1st day of the 7 day period. This packet updates the machine with new passwords and user info, but it only works if the machine ip number has changed which is the reason for the reboot so that the ip will change at a certain time. It also clears out any open sessions that have stalled.

Thanks for the advice,
Will

Dave Liquorice

Re: Automatic reboot
« Reply #5 on: February 26, 2003, 02:06:34 AM »
The format of a /etc/crontab entry is pretty simple but can look daunting. /etc/crontab is templated so you need to follow all the normal SME rules for creating a custom template.

Here is the format of an entry (hope the layout survives...)
#
# min  hour day_of_month month day_of_week
# *      *       *                      *           *
# 0-59 0-23     0-31      0-12     0-7 (0 or 7 is Sunday)

To run as user at 0200 every sunday the format is:

0 2 * * 0  

Reasonable reasons for wanting to reboot, but I can't help thiinking that there is rather a lot releying on the IP changing on a reboot. What happens if for some quirk it doesn't?

Cheers
Dave.

Will

Re: Automatic reboot
« Reply #6 on: February 26, 2003, 02:43:48 AM »
Great thanks i o you guys one!

Will

Re: Automatic reboot
« Reply #7 on: February 26, 2003, 02:43:52 AM »
Great thanks i o you guys one!

Will

Re: Automatic reboot
« Reply #8 on: February 26, 2003, 02:44:43 AM »
GREAT THANKS, I O you guys one!

rob wellesley

Re: Automatic reboot
« Reply #9 on: February 26, 2003, 06:27:39 AM »
Kelvin wrote:

> But I think, under SME, it might be more inline with SME
> itself to call
>
> /sbin/e-smith/signal-event reboot
>

A quick look at /etc/e-smith/events/actions/reboot indicates that it calls /sbin/shutdown with the -r now option

Kelvin

Re: Automatic reboot
« Reply #10 on: February 26, 2003, 06:39:04 AM »
Hmm.. OK I'm peeved :-)

Maybe this was designed so that if you have programs / add-ons that needs specific clear down instructions before rebooting you would put the instructions here.

If not, then one should avoid creating multiple non-standard means of doing the same thing. Very confusing for someone trying to grasp it all.

One minor example :-

On previous versions of SME, I used tailf as a shortcut to tail -f (which I use very often). So much so that now, with 5.6, tailf no longer works and I keep having to remember to type tail -f (too used to tailf). Sure, we could write script files to shortcut them but that just perpetuates the very problem I'm trying to highlight.

Kelvin

Charlie Brady

Re: Automatic reboot
« Reply #11 on: February 26, 2003, 11:39:42 PM »
Kelvin wrote:

> Maybe this was designed so that if you have programs /
> add-ons that needs specific clear down instructions before
> rebooting you would put the instructions here.

Correct.

> One minor example :-
>
> On previous versions of SME, I used tailf as a shortcut to
> tail -f (which I use very often). So much so that now, with
> 5.6, tailf no longer works and I keep having to remember to
> type tail -f (too used to tailf).

You'll want to speak to RedHat about that one.

Charlie