~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to utopic/etc/init.d/olad

  • 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
 
### BEGIN INIT INFO
4
 
# Provides:          olad
5
 
# Required-Start:    $remote_fs $syslog $network
6
 
# Required-Stop:     $remote_fs $syslog $network
7
 
# Default-Start:     2 3 4 5
8
 
# Default-Stop:      0 1 6
9
 
# Short-Description: OLA daemon
10
 
# Description:       Open Lighting Architecture daemon
11
 
### END INIT INFO
12
 
 
13
 
PATH=/usr/local/bin:/bin:/usr/bin
14
 
NAME=olad
15
 
DAEMON=/usr/bin/$NAME
16
 
PIDFILE=/var/run/$NAME.pid
17
 
DESC="OLA daemon"
18
 
USER=olad
19
 
 
20
 
# Reads config file (will override defaults above)
21
 
[ -r /etc/default/ola ] && . /etc/default/ola
22
 
 
23
 
if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then
24
 
  DAEMON_ARGS="--syslog --log-level 3  --config-dir  /etc/ola"
25
 
elif [ "$1" = "start" ] || [ "$1" = "stop" ] ; then
26
 
  echo "The init script is currently inactive;\nuse \"dpkg-reconfigure ola\" to change this." >&2
27
 
fi
28
 
 
29
 
[ -x "$DAEMON" ] || exit 0
30
 
 
31
 
. /lib/lsb/init-functions
32
 
 
33
 
case "$1" in
34
 
  start)
35
 
    # master switch
36
 
    if [ -n "$DAEMON_ARGS" ] ; then
37
 
      log_daemon_msg "Starting $DESC" "$NAME"
38
 
      /sbin/start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --umask 0002 --chuid $USER --exec $DAEMON -- $DAEMON_ARGS
39
 
      log_end_msg $?
40
 
    fi
41
 
    ;;
42
 
  stop)
43
 
    # master switch
44
 
    if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then
45
 
      log_daemon_msg "Stopping $DESC" "$NAME"
46
 
      /sbin/start-stop-daemon --stop --pidfile $PIDFILE --chuid $USER --exec $DAEMON --retry 10
47
 
      /bin/rm -f $PIDFILE
48
 
      log_end_msg $?
49
 
    fi
50
 
    ;;
51
 
  reload|force-reload|restart)
52
 
    $0 stop && $0 start
53
 
    ;;
54
 
  status)
55
 
    status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
56
 
    ;;
57
 
  *)
58
 
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|status}" >&2
59
 
    exit 1
60
 
    ;;
61
 
esac
62
 
 
63
 
exit 0