Simple Bash Script

Python code posted
created at 06 Feb 02:47, updated at 25 Feb 00:37

Edit | Back
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
33
34
35
36
37
38
#! /bin/sh
### BEGIN INIT INFO
# Provides:          reboot
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:      6
# Short-Description: Execute the reboot command.
# Description:
### END INIT INFO

PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/lsb/init-functions

do_stop () {
  # Message should end with a newline since kFreeBSD may
  # print more stuff (see #323749)
  log_action_msg "Will now restart"
  reboot -d -f -i
}

case "$1" in
  start)
  # No-op
  ;;
  restart|reload|force-reload)
  echo "Error: argument '$1' not supported" >&2
  exit 3
  ;;
  stop)
  do_stop
  ;;
  *)
  echo "Usage: $0 start|stop" >&2
  exit 3
  ;;
esac
677 Bytes in 4 ms with coderay