source: subversion/applications/utils/tirex/debian/tirex-core.tirex-master.simple-init @ 29268

Last change on this file since 29268 was 23242, checked in by frederik, 9 years ago

simple init scripts for non-ubuntu

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#! /bin/sh
2### BEGIN INIT INFO
3# Provides:          tirex-master
4# Required-Start:   
5# Required-Stop:     
6# Default-Start:     2 3 4 5
7# Default-Stop:      0 1 6
8# Short-Description: Tirex master server
9# Description:       Tirex master server
10### END INIT INFO
11
12# Do NOT "set -e"
13
14# PATH should only include /usr/* if it runs after the mountnfs.sh script
15PATH=/sbin:/usr/sbin:/bin:/usr/bin
16DESC="Tirex master server"
17NAME=tirex-master
18DAEMON=/usr/bin/$NAME
19DAEMON_ARGS=""
20PIDFILE=/var/run/tirex/$NAME.pid
21SCRIPTNAME=/etc/init.d/$NAME
22
23# Exit if the package is not installed
24[ -x "$DAEMON" ] || exit 0
25
26#
27# Function that starts the daemon/service
28#
29do_start()
30{
31    [ -d `dirname $PIDFILE` ] || (mkdir -p `dirname $PIDFILE` ; chown tirex:tirex `dirname $PIDFILE`)
32
33        # Return
34        #   0 if daemon has been started
35        #   1 if daemon was already running
36        #   2 if daemon could not be started
37        su tirex -c $DAEMON
38}
39
40#
41# Function that stops the daemon/service
42#
43do_stop()
44{
45        # Return
46        #   0 if daemon has been stopped
47        #   1 if daemon was already stopped
48        #   2 if daemon could not be stopped
49        #   other if a failure occurred
50        kill `cat $PIDFILE`
51}
52
53#
54# Function that sends a SIGHUP to the daemon/service
55#
56do_reload() {
57        #
58        # If the daemon can reload its configuration without
59        # restarting (for example, when it is sent a SIGHUP),
60        # then implement that here.
61        #
62        kill -HUP `cat $PIDFILE`
63}
64
65case "$1" in
66  start)
67        do_start
68        ;;
69  stop)
70        do_stop
71        ;;
72  restart|force-reload)
73        #
74        # If the "reload" option is implemented then remove the
75        # 'force-reload' alias
76        #
77        do_stop
78        do_start
79        ;;
80  *)
81        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
82        exit 3
83        ;;
84esac
85
86:
Note: See TracBrowser for help on using the repository browser.