ftp.nice.ch/pub/next/tools/system/power.N.bs.tar.gz#/power

Makefile
 
README
 
ctime.c
[View ctime.c] 
getdate.c
[View getdate.c] 
getdate.y
 
getpwr.c
[View getpwr.c] 
halt
 
power.c
[View power.c] 
setpower
 
setpwr.c
[View setpwr.c] 

README

Setting automatically the power on time on NeXT Computers
=========================================================

Enclosed you find some programs for setting the auto-power-on time
automatically under program control without using the Preferences Application.

Only some NeXTs with a special version of RTC Chip are able to power themself
on at a certain time. If there is a PopUp button in the Startup Preferences
(in the Preferences Apllication) with "Startup Device" and "Power", you are 
one of the lucky. The people who don't have this feature don't normally miss 
it; it's nearly undocumented.



The programs are:

setpwr	setting the next power on time and enable/disable it
		usage: setpwr [-on|-off] t_time
		t_time are seconds since 1 Jan 1970
				
getpwr	getting the next power on time test if it is enabled
		usage: getpwr
		print next power on time in seconds since 1 Jan 1970 to
		stdout and return 0 if power on is enabled and 1 if disabled
		
getdate converts a human-readable date/time to time since epoch (number of
		seconds since 1 Jan 1970)

ctime	converts seconds since 1 Jan 1970 into a human-readable form

see also man pages for ctime(1), ctime(3), getdate(1), getdate(3)



How to achieve a daily power on?

setpwr only sets the power time once. If you want to power on you NeXT every
day automatically, you have to do it via cron or even better, via /etc/halt.

Each time the NeXT is powered down (with the power key or with shutdown -h -p) 
/etc/halt is executed. Therefore this is a good place for setting the next 
power on time.

Rename /usr/etc/halt to /usr/etc/halt.dist and put this or a similar script
into /usr/etc/halt instead:


#!/bin/csh
#
set LOGFILE = /usr/adm/power.log
#
echo `date` halt: $* >>$LOGFILE
/usr/local/etc/setpower  >>$LOGFILE
/usr/etc/halt.dist $*


/usr/local/etc/setpower is the script that comes with these programs. setpower 
counts the old power on time in 86400 second (a day) increments to a 
time > current time and sets the new power on time. You have to enable the 
power on feature (via Preferences or via setpwr -on) in order to get the NeXT 
to power on!

BTW: You have to be root to set the power on time!

Please regard the programs as is. I even didn't have the chance to test them 
before distributing, because my new board does not have the right RTC chip!

Thanks to Reimer A. Mellin (ram@ramsys.sta.sub.org) who put my clumsy 
assembler routines and his knowledge together in power.c!

Christian Baur
cbaur@blabel.sta.sub.org (NeXTMail)
cbaur@pst.informatik.uni-muenchen.de (NeXTMail)

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.