~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

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

  • Committer: Dimitri John Ledkov
  • Date: 2014-07-31 11:28:21 UTC
  • Revision ID: dimitri.ledkov@canonical.com-20140731112821-71s8qtcv4b67a5g9
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
# Required-Stop:     $remote_fs
6
6
# Default-Start:     2 3 4 5
7
7
# Default-Stop:      0 1 6
8
 
# Short-Description: Start iwatch, realtime filesystem monitoring program using inotify
 
8
# Short-Description: iwatch daemon control
 
9
# Description:       Start iwatch, realtime filesystem monitoring
 
10
#                    program using inotify
9
11
### END INIT INFO
 
12
 
10
13
set -eu
 
14
 
11
15
##############################################################################
 
16
 
 
17
CONFIG_FILE=/etc/iwatch/iwatch.xml
 
18
DEBIANCONFIG=/etc/default/iwatch
12
19
IWATCHD=/usr/bin/iwatch
13
 
PATH="/sbin:/bin"
14
 
DEBIANCONFIG=/etc/default/iwatch
 
20
PATH=/usr/sbin:/usr/bin:/sbin:/bin
15
21
PIDFILE=/var/run/iwatch.pid
 
22
START_DAEMON=true
16
23
 
17
24
test -x $IWATCHD || exit 0
18
25
 
19
 
CONFIG_FILE=/etc/iwatch/iwatch.xml
20
 
START_DAEMON=true
21
26
test -f $DEBIANCONFIG && . $DEBIANCONFIG
22
27
 
23
28
. /lib/lsb/init-functions
29
34
    *) return 1;
30
35
  esac
31
36
}
 
37
 
32
38
##############################################################################
33
39
 
34
40
case "${1:-}" in
59
65
         rm -f $PIDFILE
60
66
         set -e
61
67
         log_end_msg $RC
 
68
      else
 
69
         log_warning_msg "iwatch daemon already stopped."
62
70
      fi
63
71
      ;;
64
72
 
65
73
    status)
66
74
      [ -f "$PIDFILE" ] && PROCESS="$(cat $PIDFILE)" || PROCESS=''
67
75
      if [ -n "$PROCESS" ] ; then
68
 
         log_success_msg "iwatch daemon with pid $PROCESS is running."
 
76
         log_success_msg "iwatch daemon with pid $PROCESS is running"
69
77
         exit 0
70
78
      else
71
79
         log_warning_msg "Could not find a running iwatch daemon."
73
81
      fi
74
82
      ;;
75
83
 
76
 
    restart|reload|force-reload)
 
84
    restart)
77
85
      $0 stop
78
86
      $0 start
79
87
      ;;
80
88
 
 
89
    reload|force-reload)
 
90
      if [ -f "$PIDFILE" ] ; then
 
91
         log_daemon_msg "Reloading iwatch daemon" "iwatch"
 
92
         start-stop-daemon --stop --signal 1 --pidfile $PIDFILE
 
93
         RC=$?
 
94
         log_end_msg $RC
 
95
      else
 
96
         log_warning_msg "Could not find a running iwatch daemon."
 
97
         exit 1
 
98
      fi
 
99
      ;;
 
100
 
81
101
    *)
82
102
      echo "Usage: ${0:-} {start|stop|restart|reload|force-reload|status}" >&2
83
103
      exit 1
85
105
esac
86
106
 
87
107
exit 0
88
 
 
89
 
# vim: ai expandtab