~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to etc/init.d/mgetty-fax

  • Committer: Dimitri John Ledkov
  • Date: 2014-05-06 18:45:46 UTC
  • Revision ID: dimitri.ledkov@canonical.com-20140506184546-5toyx56xxrue0f0v
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
### BEGIN INIT INFO
3
 
# Provides:          mgetty-fax
4
 
# Required-Start:    $remote_fs $syslog
5
 
# Required-Stop:     $remote_fs $syslog
6
 
# Default-Start:     2 3 4 5
7
 
# Default-Stop:      0 1 6
8
 
### END INIT INFO
9
 
 
10
 
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
11
 
DAEMON=/usr/sbin/faxrunqd
12
 
NAME=faxrunqd
13
 
DESC="Fax Queue Daemon"
14
 
 
15
 
test -f $DAEMON || exit 0
16
 
 
17
 
check_for_no_start() {
18
 
    # (function copied from ssh init script)
19
 
    # exit if we're trying to start and /etc/mgetty/.faxrunqd_not_to_be_run exists
20
 
    if [ -e /etc/mgetty/.faxrunqd_not_to_be_run ]; then 
21
 
        exit 0
22
 
    fi
23
 
}
24
 
 
25
 
if [ ! -d /var/lock/fax ]; then
26
 
        mkdir /var/lock/fax
27
 
        chown uucp:root /var/lock/fax
28
 
fi
29
 
if [ ! -d /var/run/mgetty-fax ]; then
30
 
        mkdir /var/run/mgetty-fax
31
 
        chown uucp:root /var/run/mgetty-fax
32
 
fi
33
 
 
34
 
case "$1" in
35
 
  start)
36
 
        check_for_no_start
37
 
        if grep -q "^fax-devices" /etc/mgetty/faxrunq.config; then
38
 
          echo -n "Starting $DESC: "
39
 
          start-stop-daemon --start --quiet --pidfile /var/run/mgetty-fax/$NAME.pid \
40
 
                --exec $DAEMON -- -D -u uucp -g dialout
41
 
          echo "$NAME."
42
 
        else
43
 
          echo "$DESC not yet configured while configured for starting within the debconf database."
44
 
          echo "Please either edit /etc/mgetty/faxrunq.config or run \"dpkg-reconfigure mgetty-fax\" to fix this problem."
45
 
          exit 0
46
 
        fi
47
 
        ;;
48
 
  stop)
49
 
        echo -n "Stopping $DESC: $NAME."
50
 
        [ -f /var/run/mgetty-fax/$NAME.pid ] && echo || echo " (not running)"
51
 
        start-stop-daemon --stop --quiet \
52
 
                --retry -HUP/60/-TERM \
53
 
                --pidfile /var/run/mgetty-fax/$NAME.pid \
54
 
                --oknodo --name $NAME --signal HUP
55
 
        ;;
56
 
  #reload)
57
 
        #
58
 
        #       If the daemon can reload its config files on the fly
59
 
        #       for example by sending it SIGHUP, do it here.
60
 
        #
61
 
        #       If the daemon responds to changes in its config file
62
 
        #       directly anyway, make this a do-nothing entry.
63
 
        #
64
 
        # echo "Reloading $DESC configuration files."
65
 
        # start-stop-daemon --stop --signal 1 --quiet --pidfile \
66
 
        #       /var/run/$NAME.pid --exec $DAEMON
67
 
  #;;
68
 
  restart|force-reload)
69
 
        #
70
 
        #       If the "reload" option is implemented, move the "force-reload"
71
 
        #       option to the "reload" entry above. If not, "force-reload" is
72
 
        #       just the same as "restart".
73
 
        #
74
 
        echo -n "Restarting $DESC: "
75
 
        $0 stop
76
 
        sleep 1
77
 
        $0 start
78
 
        echo "$NAME."
79
 
        ;;
80
 
  *)
81
 
        N=/etc/init.d/$NAME
82
 
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
83
 
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
84
 
        exit 1
85
 
        ;;
86
 
esac
87
 
 
88
 
exit 0