rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | ### BEGIN INIT INFO |
| 3 | # Provides: wmtd |
| 4 | # Required-Start: $syslog $local_fs $remote_fs $network |
| 5 | # Required-Stop: $syslog $local_fs $remote_fs $network |
| 6 | # Default-Start: 2 3 4 5 |
| 7 | # Default-Stop: 0 1 6 |
| 8 | # Short-Description: WMT Daemon |
| 9 | ### END INIT INFO |
| 10 | |
| 11 | . /etc/init.d/init-functions |
| 12 | prog=wmtd |
| 13 | PIDFILE=/var/run/$prog.pid |
| 14 | DESC="WMT Daemon" |
| 15 | start() { |
| 16 | log_daemon_msg "Starting $DESC" "$prog" |
| 17 | start_daemon_background -p $PIDFILE /usr/bin/wmt_loader |
| 18 | if [ $? -ne 0 ]; then |
| 19 | log_end_msg 1 |
| 20 | exit 1 |
| 21 | fi |
| 22 | if [ $? -eq 0 ]; then |
| 23 | log_end_msg 0 |
| 24 | fi |
| 25 | exit 0 |
| 26 | } |
| 27 | |
| 28 | stop() { |
| 29 | log_daemon_msg "Stopping $DESC" "$prog" |
| 30 | killproc -p $PIDFILE /usr/bin/wmt_loader |
| 31 | if [ $? -ne 0 ]; then |
| 32 | log_end_msg 1 |
| 33 | exit 1 |
| 34 | fi |
| 35 | if [ $? -eq 0 ]; then |
| 36 | log_end_msg 0 |
| 37 | fi |
| 38 | } |
| 39 | |
| 40 | force_reload() { |
| 41 | stop |
| 42 | start |
| 43 | |
| 44 | } |
| 45 | |
| 46 | case "$1" in |
| 47 | start) |
| 48 | start |
| 49 | ;; |
| 50 | stop) |
| 51 | stop |
| 52 | ;; |
| 53 | force-reload) |
| 54 | force_reload |
| 55 | ;; |
| 56 | restart) |
| 57 | stop |
| 58 | start |
| 59 | ;; |
| 60 | |
| 61 | *) |
| 62 | echo "$Usage: $prog {start|stop|force-reload|restart}" |
| 63 | exit 2 |
| 64 | esac |