~ubuntu-branches/ubuntu/trusty/exabgp/trusty

« back to all changes in this revision

Viewing changes to debian/init.d

  • Committer: Package Import Robot
  • Author(s): Henry-Nicolas Tourneur
  • Date: 2012-03-22 12:00:00 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120322120000-v4aj8h69mhpmgbjq
Tags: 2.0.7-1

* New upstream release
* Fix bad clean target for build/ directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
# Some env var the daemon will need
33
33
export ETC="/etc/exabgp/"
34
34
 
35
 
# This will tell the daemon it needs to daemonize itself
36
 
export DAEMONIZE=1
37
 
 
38
35
# Read configuration variable file if it is present
39
36
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
40
37
 
56
53
do_start()
57
54
{
58
55
        if [ "$EXABGPRUN" = "yes" ] || [ "$EXABGPRUN" = "YES" ]; then
59
 
                status_of_proc "$DAEMON" "$NAME" >/dev/null
 
56
                status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" > /dev/null 2>&1
60
57
                retcode=$?
61
58
                if [ $retcode -ne 0 ]; then
62
59
                        # Return
63
60
                        #   0 if daemon has been started
64
61
                        #   1 if daemon was already running
65
62
                        #   2 if daemon could not be started
66
 
                        start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER --exec $DAEMON -- $DAEMON_OPTS || return 2
 
63
                        # We create the PID file and we do background thanks to start-stop-daemon
 
64
                        start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER -b -m --exec $DAEMON -- $DAEMON_OPTS || return 2
67
65
                else
68
66
                        log_daemon_msg "$NAME is already running!"
69
67
                        log_end_msg 0
86
84
                start-stop-daemon --stop --quiet --signal TERM --pidfile $PIDFILE -c $USER
87
85
                RETVAL="$?"
88
86
                sleep 1
 
87
                # clean stale PID file
 
88
                rm $PIDFILE
89
89
                [ "$RETVAL" = 2 ] && return 2
90
90
                # Wait for children to finish too if this is a daemon that forks
91
91
                # and if the daemon is only ever run from this initscript.
105
105
#
106
106
do_reload() {
107
107
        if [ "$EXABGPRUN" = "yes" ] || [ "$EXABGPRUN" = "YES" ]; then
108
 
                start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --name $NAME -c $USER
 
108
                start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE -c $USER
109
109
                return 0
110
110
        fi
111
111
}
159
159
        ;;
160
160
esac
161
161
 
162
 
:
 
162
exit 0