home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
System
/
Sysmon
/
s
/
Shutdown
next >
Wrap
AmigaDOS Script File
|
2000-05-30
|
2KB
|
90 lines
.KEY countdown,reboot/s,rekick/s,noconf/s,quick/s
; $VER: Shutdown 1.2 (28.2.2000) © 1995-2000 by Etienne Vogt
; Sysmon system shutdown script
FailAt 100
Echo "*N*E[37m SHUTDOWN *E[0m - Halt the system safely*N"
If <noconf> NOT EQ "noconf"
Ask "*E[33mAre you sure you want to do this ?*E[0m"
If WARN
Skip OK
Else
Quit 20
EndIf
EndIf
Lab OK
ChangeTaskPri 2 ; Bump priority
If <quick> EQ "quick"
Set timeout 10
Else
Set timeout 50
EndIf
Set count <countdown$0>
If $count GT 10 VAL
Set count 10
EndIf
Broadcast "$hostname will shutdown in $count minute(s)*N" SHUTDOWN COUNTDOWN=`Eval $count * 60` TIMEOUT=$timeout
If $count NOT GT 0 VAL
Skip Now
EndIf
Lab Loop
If $count GT 5 VAL
Set next 5
Skip Waiting
EndIf
If $count GT 3 VAL
Set next 3
Else
Set next `Eval $count - 1`
EndIf
Lab Waiting
Wait `Eval $count - $next` min
If WARN
Broadcast "$hostname shutdown has been cancelled*N" SHUTDOWN CANCEL
Quit 10
Else
Broadcast "$hostname will shutdown in $next minute(s)*N" SHUTDOWN COUNTDOWN=`Eval $next * 60` TIMEOUT=$timeout
EndIf
Set count $next
If $count GT 0 VAL
Skip BACK Loop
EndIf
Lab Now
UnSet count
UnSet next
SysLog "Shutdown : $hostname shutdown requested by operator" LEVEL=4
If <quick> NOT EQ "quick"
If EXISTS S:User-Shutdown
Echo "*NExecuting User-Shutdown script..."
Execute S:User-Shutdown
EndIf
Wait 2 sec
EndIf
Echo "*NDismounting disk volumes..."
Copy >NIL: C:Wait C:UnMount C:Execute C:Halt C:Broadcast RAM: ; Copy needed commands
CD RAM:
Assign C: RAM:
Path RAM: RESET
Broadcast >NIL: "Dismounting disk volumes*N" UNMOUNT TIMEOUT=$timeout
UnMount ALL INHIBIT
If <quick> NOT EQ "quick"
If EXISTS Final-Shutdown
Echo "*NExecuting Final-Shutdown script..."
Execute Final-Shutdown
EndIf
Wait 2 sec
EndIf
Echo "*NSystem going down..."
Broadcast >NIL: "System going down*N" HALT TIMEOUT=$timeout
Halt <reboot> <rekick>
Echo "*NSystem Shutdown failed."
Quit 100