File: pwrfail

package info (click to toggle)
runit 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,220 kB
  • sloc: ansic: 5,572; sh: 3,588; makefile: 383
file content (19 lines) | stat: -rwxr-xr-x 458 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

PATH=/usr/bin:/bin
MSG="power failure event, powering off ..."
# stopit has already the x mode set if exists
touch /etc/runit/stopit
chmod +x /etc/runit/stopit
echo "$MSG" | wall
exit

##perform alternative action, do not shutdown
# ..do stuff here..
#touch /etc/runit/stopit
#chmod -x /etc/runit/stopit ; exit

##reboot instead of poweroff
#touch /etc/runit/stopit; touch /etc/runit/reboot
#chmod -x /etc/runit/stopit
#chmod +x /etc/runit/reboot