summaryrefslogtreecommitdiffstats
path: root/source/a/nut/rc.nut-drvctl
blob: c310d26c8f447c9dbcbd61ed73bb2626a237f258 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
# NUT ups model-specific drivers start-up and shutdown script.
# This should be started before rc.nut-upsd on the machine connected to the
# UPS's control port. See /etc/nut/ for configuration files.

# Start upsdrvctl:
upsdrvctl_start() {
  # Make sure the runtime directory is there:
  mkdir -p /run/nut
  chown -R nut:nut /run/nut
  chmod 0770 /run/nut
  # Load NUT driver(s):
  echo "Starting the NUT UPS driver controller:  upsdrvctl -u nut start"
  upsdrvctl -u nut start
}

# Stop upsdrvctl:
upsdrvctl_stop() {
  echo "Stopping the NUT UPS driver controller."
  upsdrvctl stop
}

case "$1" in
'start')
  upsdrvctl_start
  ;;
'stop')
  upsdrvctl_stop
  ;;
*)
  echo "usage $0 start|stop"
esac