From: neilsolent on

Automatic? Careful - that's sounding a lot like a script 8-O


From: Rainer Weikusat on
neilsolent <n(a)solenttechnology.co.uk> writes:
> On 16 Jan, 22:26, David Schwartz <dav...(a)webmaster.com> wrote:
>> On Jan 16, 7:52�am, neilsolent <n...(a)solenttechnology.co.uk> wrote:

[...]

>> > On Solaris, I find /usr/bin/shutdown does not seem to SIGTERM all the
>> > processes (I guess - it assumes every process has a shutdown script if
>> > it needs it). I find the reboot command does send a SIGTERM to the
>> > processes. Ideally - the shutdown scripts are run, and remaining
>> > processes are signalled.
>> > Thoughts / experiences anyone?
>> > What's a standard script for rebooting UNIX?
>>
>> There is no standard script. Every system is different, and rightfully
>> and necessarily so.
>>
>> Why are you rebooting the machine from a script anyway?
>
> Why write a script to do anything?
> We could all just do a lot of typing - it's fun :-)

It's a waste of time in this case: If reboots aren't infrequent enough
that doing them manually doesn't matter, that hints at another problem
which should be solved first. Especially, since 'rebooting'
necessarily means 'interruption of service'. This doesn't matter much
if some user choses to reboot is 'GUI typewriter' because it doesn't
affect anyone except himself. But this is not true for anything
running servers, programs which are intended to provide services to
other programs, eg, for the sake of the example, let's assume that a
computer providing DHCP is being rebooted: Until this service is again
available, people trying to use 'the network' from their computers
will run into all kinds of problems. It doesn't really matter if there
are only five minutes of downtime should someone important enough
chose to reboot his laptop for some reason during this period.
From: David Schwartz on
On Jan 16, 11:21 pm, neilsolent <n...(a)solenttechnology.co.uk> wrote:

> > Why are you rebooting the machine from a script anyway?

> Why write a script to do anything?
> We could all just do a lot of typing - it's fun :-)

I'm trying to understand your problem so I can help you solve it. If
you're in some special circumstance where it makes sense to reboot a
machine from a script, that might suggest how the reboot has to be
accomplished.

You may wish to go to this website http://www.thewebsiteisdown.com/
and watch episode 1. Particularly the "did you just reboot the web
server?" part wherein a support guy is bullied into rebooting a
perfectly-working server (because someone "said that was what you guys
did last time it wasn't working") only to discover the server won't
reboot properly and needs to be unplugged and plugged back in. A bit
of confusion over the phone line causes the "remote hands" guy to
unplug a different computer as well... You have to see it.

Typically, rebooting a machine requires coordination among multiple
humans and multiple services. If you reboot some machines without
first disarming their remote monitoring, ...

DS
From: neilsolent on
On 17 Jan, 16:19, Rainer Weikusat <rweiku...(a)mssgmbh.com> wrote:
> neilsolent <n...(a)solenttechnology.co.uk> writes:
> > On 16 Jan, 22:26, David Schwartz <dav...(a)webmaster.com> wrote:
> >> On Jan 16, 7:52 am, neilsolent <n...(a)solenttechnology.co.uk> wrote:
>
> [...]
>
> >> > On Solaris, I find /usr/bin/shutdown does not seem to SIGTERM all the
> >> > processes (I guess - it assumes every process has a shutdown script if
> >> > it needs it). I find the reboot command does send a SIGTERM to the
> >> > processes. Ideally - the shutdown scripts are run, and remaining
> >> > processes are signalled.
> >> > Thoughts / experiences anyone?
> >> > What's a standard script for rebooting UNIX?
>
> >> There is no standard script. Every system is different, and rightfully
> >> and necessarily so.
>
> >> Why are you rebooting the machine from a script anyway?
>
> > Why write a script to do anything?
> > We could all just do a lot of typing - it's fun :-)
>
> It's a waste of time in this case: If reboots aren't infrequent enough
> that doing them manually doesn't matter, that hints at another problem
> which should be solved first.

Depends how many systems are being rebooted. Also, scripts do more
than save typing - help to prevent typos as well, and save you from
having to remember a procedure.

> Especially, since 'rebooting'
> necessarily means 'interruption of service'.

No it doesn't. System may be clustered, for example.

> This doesn't matter much
> if some user choses to reboot is 'GUI typewriter' because it doesn't
> affect anyone except himself. But this is not true for anything
> running servers, programs which are intended to provide services to
> other programs, eg, for the sake of the example, let's assume that a
> computer providing DHCP is being rebooted: Until this service is again
> available, people trying to use 'the network' from their computers
> will run into all kinds of problems. It doesn't really matter if there
> are only five minutes of downtime should someone important enough
> chose to reboot his laptop for some reason during this period.

From: neilsolent on
On 17 Jan, 19:33, David Schwartz <dav...(a)webmaster.com> wrote:
> On Jan 16, 11:21 pm, neilsolent <n...(a)solenttechnology.co.uk> wrote:
>
> > > Why are you rebooting the machine from a script anyway?
> > Why write a script to do anything?
> > We could all just do a lot of typing - it's fun :-)
>
> I'm trying to understand your problem so I can help you solve it. If
> you're in some special circumstance where it makes sense to reboot a
> machine from a script, that might suggest how the reboot has to be
> accomplished.

... and I have given up on getting any useful info from this thread!
I am just enjoying the banter instead :-)

> You may wish to go to this websitehttp://www.thewebsiteisdown.com/
> and watch episode 1. Particularly the "did you just reboot the web
> server?" part wherein a support guy is bullied into rebooting a
> perfectly-working server (because someone "said that was what you guys
> did last time it wasn't working") only to discover the server won't
> reboot properly and needs to be unplugged and plugged back in. A bit
> of confusion over the phone line causes the "remote hands" guy to
> unplug a different computer as well... You have to see it.
>
> Typically, rebooting a machine requires coordination among multiple
> humans and multiple services. If you reboot some machines without
> first disarming their remote monitoring, ...
>
> DS

Yes, and broadly I agree. This is your assumption though - that I am
attempting to reboot systems willy nilly.
All I was asking was about how to reboot a UNIX system from a C
program. There are plenty of commerical 3rd party apps out there that
do this.
Let's say it's up to the user whether he wants to do it or not, I just
provide the capability.
In my opinion, there should be standards such that you can just call a
simple command to do a reboot - and all the complexity of taking care
of the applications etc is hidden from the user (typically implemented
by shutdown scripts, or whatever). This is not because the user is
stupid, but because it's not practical to remember the exact source
code for every application running when he is aksed to do a reboot at
3am in the morning.