~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init.d/jabber-irc

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
#
 
3
# skeleton      example file to build /etc/init.d/ scripts.
 
4
#               This file should be used to construct scripts for /etc/init.d.
 
5
#
 
6
#               Written by Miquel van Smoorenburg <miquels@cistron.nl>.
 
7
#               Modified for Debian 
 
8
#               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
 
9
#
 
10
# Version:      @(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
 
11
#
 
12
 
 
13
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
14
DAEMON=/usr/sbin/jabberd-irc
 
15
CMDLINE=/usr/bin/python/usr/sbin/jabberd-irc
 
16
NAME=jabber-irc
 
17
DESC=jabber-irc
 
18
ARGS=''
 
19
PID=/var/run/jabber/$NAME.pid
 
20
ENABLED='0'
 
21
 
 
22
# Create needed dir in /var/run.
 
23
if [ ! -d /var/run/jabber ] ; then
 
24
        mkdir /var/run/jabber
 
25
        chown jabber:adm /var/run/jabber
 
26
        chmod 0775 /var/run/jabber
 
27
fi
 
28
 
 
29
if [ -f /etc/default/jabber-irc ]; then
 
30
   . /etc/default/jabber-irc
 
31
fi
 
32
 
 
33
. /lib/lsb/init-functions
 
34
 
 
35
test -x $DAEMON -a "$ENABLED" -eq "1" || exit 0
 
36
 
 
37
set -e
 
38
 
 
39
case "$1" in
 
40
  start)
 
41
   if [ -e $PID ]; then
 
42
     PIDDIR=/proc/$(cat $PID)
 
43
     if [ -d ${PIDDIR} -a "$(cat ${PIDDIR}/cmdline)" = "$CMDLINE" ]; then 
 
44
       log_success_msg "$DESC already started; not starting"
 
45
       exit
 
46
     else
 
47
       log_success_msg "Removing stale PID file $PID"
 
48
       rm -f $PID
 
49
     fi
 
50
   fi
 
51
 
 
52
   log_daemon_msg "Starting $DESC: "
 
53
   export PID
 
54
   start-stop-daemon -b -c jabber:adm --start --quiet --pidfile $PID\
 
55
      --make-pidfile --exec $DAEMON -- $ARGS
 
56
   echo "$NAME."
 
57
   ;;
 
58
  stop)
 
59
        echo -n "Stopping $DESC: "
 
60
        start-stop-daemon -o --stop --signal INT --quiet --retry 3 \
 
61
                --pidfile $PID --exec /usr/bin/python
 
62
        echo "$NAME."
 
63
        rm -f $PID
 
64
        ;;
 
65
  #reload)
 
66
        #
 
67
        #       If the daemon can reload its config files on the fly
 
68
        #       for example by sending it SIGHUP, do it here.
 
69
        #
 
70
        #       If the daemon responds to changes in its config file
 
71
        #       directly anyway, make this a do-nothing entry.
 
72
        #
 
73
        # echo "Reloading $DESC configuration files."
 
74
        # start-stop-daemon --stop --signal 1 --quiet --pidfile \
 
75
        #       /var/run/jabber/$NAME.pid --exec $DAEMON
 
76
  #;;
 
77
  restart|force-reload)
 
78
        #
 
79
        #       If the "reload" option is implemented, move the "force-reload"
 
80
        #       option to the "reload" entry above. If not, "force-reload" is
 
81
        #       just the same as "restart".
 
82
        #
 
83
   $0 stop
 
84
        sleep 3
 
85
   $0 start
 
86
        ;;
 
87
  *)
 
88
        N=/etc/init.d/$NAME
 
89
        # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
 
90
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
 
91
        exit 1
 
92
        ;;
 
93
esac
 
94
 
 
95
exit 0