Site Index - Feedback - Impressum |
| |||||||||
|
|
( Archiv ) | ( Neues Thema ) |
27.04.2005 |
USPMON 0.01a als REXX (10:43:15) | ^ |
/* UPSMON v 0.01a */
/* (c) Larin Yury */ if RxFuncQuery('SysLoadFuncs') then do call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs end /* set device driver name */ ddName = 'UPSMON' /* set intervals */ Interval = 15 ShutDownInterval = 300 do forever rc = UPSPowerStatus() select when rc = 1 then do say time() 'Power good' i = 0 end when rc = 0 then do say time() 'Power off' i = i + Interval if i >= ShutDownInterval then do 'shutdown o' exit end end when rc = 255 then say 'Device driver' ddName 'currently in use. Please try later.' otherwise say 'Unknown data = 'rc end call SysSleep Interval end UPSPowerStatus: /* acquire the device driver */ rc=stream(ddName,'command','open') if rc = 'READY:' then do oiBuffer = substr(x2c(a1 01 13 03 00 00 07 00),1,15,x2c(00)) rc=charout(ddName,oiBuffer) rc=stream(ddName,'description') if rc \= 'READY:' then say 'Error!' /* release the device driver */ rc=stream(ddName,'command','close') return c2d(substr(oiBuffer,10,1)) end return 255 [ Leser: 75 ] |
|
Mit * markierte Felder müssen ausgefüllt werden ! |
( Zeige alle Einträge ) | ( Zur Startübersicht ) |
|
| 75 | 27.04.2005 | 10:43 |
|