Re: Automatic shutdown



Günther Schwarz wrote:
I have some PCs that are not in regular use at the moment. Still they
should be included in the backup, get their patches and stay up to date
as far as the network configuration is concerned. So they receive a
wake on LAN call every night at backup time and shut down two hours
later triggered by a crontab entry. Cron.daily cares about the updates.
Instead of the shutdown at a fixed time by crond I would like them to
configure such that they shut down automatically provided that
- uptime is at least two hours
- nobody is logged in
- no backup job is running (amanda)
- load is below a given threshold
Is there an simple way to accomplish this with openSuSE? I know about
kPowersave. But this is based on user settings which are not of
interest here. I also prefer init 0 to suspend or hibernate. The
additional boot time is not relevant in this case.

It depends on 'simple'. First: why do you need 2 hours uptime? I asume
you do this so the updates are done. This can either be too long (in
most cases) or not long enough if there is a problem with the connection
and it is slowed down.

What I would do is write a bash script that does the following:
#!/bin/bash
run_backup
run_update
run_shutdown

The first should be fairly easy. The second as well. The advantage is
that the second waits for the first to finish. next the update is done
and only after the update is done, do you start the shutdown.

That part can do several things, some you might not need
1) See what time it is. Shutting down at 8:30 when people start working
at 8:45 is silly.
2) See if anybody is still logged in
2a) See if they were idle for 2 hours or more)
2b) See what programs they are running
3) check the load
4) Look back every 15 minutes

This can be made as easy and as complicated as you desire.

The advantage of running a script is that it itself will see that it
waits for program A to finish before it starts with program B. The real
chalange will be what to do with errors. If there is no
networkconnection to the Interweb, should it continue with the update,
wait adn try again, do the backup first and then the update?
What if the backup gives problems?

houghi
--
If God doesn't destroy Hollywood Boulevard, he owes Sodom and
Gomorrah an apology.
.



Relevant Pages

  • Re: Default Group Membership
    ... So if they are not have the task for backup or network configuration in your domain you can safely remove them. ... We have ~60 Accounts in Backup Operators and ~45 in Network ...
    (microsoft.public.windows.server.active_directory)
  • Re: Automatic shutdown
    ... should be included in the backup, get their patches and stay up to date ... as far as the network configuration is concerned. ... wake on LAN call every night at backup time and shut down two hours ... Instead of the shutdown at a fixed time by crond I would like them to ...
    (alt.os.linux.suse)
  • Re: Error handling in bash scripts
    ... > I'm trying my hand at bash script programming and was wondering how to ... > echo Creating copy of newest backup... ... make will immediately exit if one of the ...
    (comp.os.linux.misc)
  • Re: Windows Explorer/I.E. Version 7
    ... restored to factory settings twice in that period because of viruses and the fact that I didn't have much data to backup. ... Now I have better protection so I feel comfortable installing more programs and such. ... I come back the next day and double click the IE icon and it takes 15-20mins for my homepage to load after waiting 5 mins for IE to load. ...
    (microsoft.public.windowsxp.perform_maintain)
  • [HPADM] Re: RP5450 HP-UX B.11.00 load increasing after reboot?
    ... It looks like the Veritas backup client is causing the problem. ... After a reboot Friday night, today about 58 "bpbkar" processes are running. ... Our backup operator keeps getting time outs and the backup failing as well. ... RP5450 HP-UX B.11.00 load increasing after reboot? ...
    (HP-UX-Admin)