~john-koepi/ubuntu/trusty/memcached/default

« back to all changes in this revision

Viewing changes to debian/patches/01_init_script_additions.patch

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2011-10-05 13:27:39 UTC
  • mfrom: (1.1.8 upstream) (3.3.4 sid)
  • Revision ID: james.westby@ubuntu.com-20111005132739-ntsnlj16fcze221i
Tags: 1.4.7-0.1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Run as 'memcache' user instead of nobody (LP #599461)
  - Depend on adduser for preinst/postrm
  - Create user in postinst

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: memcached-1.4.5/scripts/memcached-init
2
 
===================================================================
3
 
--- memcached-1.4.5.orig/scripts/memcached-init
4
 
+++ memcached-1.4.5/scripts/memcached-init
5
 
@@ -1,22 +1,14 @@
6
 
 #! /bin/sh
7
 
-#
8
 
-# skeleton  example file to build /etc/init.d/ scripts.
9
 
-#       This file should be used to construct scripts for /etc/init.d.
10
 
-#
11
 
-#       Written by Miquel van Smoorenburg <miquels@cistron.nl>.
12
 
-#       Modified for Debian
13
 
-#       by Ian Murdock <imurdock@gnu.ai.mit.edu>.
14
 
-#
15
 
-# Version:  @(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
16
 
-#
17
 
 ### BEGIN INIT INFO
 
1
--- a/scripts/memcached-init
 
2
+++ b/scripts/memcached-init
 
3
@@ -1,14 +1,14 @@
 
4
 #! /bin/bash
 
5
-### BEGIN INIT INFO
18
6
-# Provides:          memcached
19
7
-# Required-Start:    $syslog
20
8
-# Required-Stop:     $syslog
 
9
-# Should-Start:        $local_fs
 
10
-# Should-Stop:        $local_fs
21
11
-# Default-Start:     2 3 4 5
22
12
-# Default-Stop:      0 1 6
23
 
-# Short-Description: Start memcached daemon at boot time
24
 
-# Description:       Enable memcached server
25
 
+# Provides:            memcached
26
 
+# Required-Start:      $remote_fs $syslog
27
 
+# Required-Stop:       $remote_fs $syslog
28
 
+# Should-Start:                $local_fs
29
 
+# Should-Stop:         $local_fs
30
 
+# Default-Start:       2 3 4 5
31
 
+# Default-Stop:                0 1 6
32
 
+# Short-Description:   Start memcached daemon
33
 
+# Description:         Start up memcached, a high-performance memory caching daemon
 
13
-# Short-Description:    memcached - Memory caching daemon
 
14
-# Description:        memcached - Memory caching daemon
 
15
+### BEGIN INIT INFO
 
16
+# Provides:            memcached
 
17
+# Required-Start:      $remote_fs $syslog
 
18
+# Required-Stop:       $remote_fs $syslog
 
19
+# Should-Start:                $local_fs
 
20
+# Should-Stop:         $local_fs
 
21
+# Default-Start:       2 3 4 5
 
22
+# Default-Stop:                0 1 6
 
23
+# Short-Description:   Start memcached daemon
 
24
+# Description:         Start up memcached, a high-performance memory caching daemon
34
25
 ### END INIT INFO
35
26
 
36
 
 
37
 
@@ -32,38 +24,50 @@ test -x $DAEMONBOOTSTRAP || exit 0
 
27
 # Usage:
 
28
@@ -35,6 +35,13 @@
38
29
 
39
30
 set -e
40
31
 
44
35
+ENABLE_MEMCACHED=no
45
36
+test -r /etc/default/memcached && . /etc/default/memcached
46
37
+
 
38
+
 
39
 FILES=(/etc/memcached_*.conf)
 
40
 # check for alternative config schema
 
41
 if [ -r "${FILES[0]}" ]; then
 
42
@@ -74,37 +81,47 @@
 
43
   PIDFILE="/var/run/${NAME}.pid"
 
44
 
47
45
 case "$1" in
48
46
-    start)
49
47
-        echo -n "Starting $DESC: "
50
 
-        start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
 
48
-        start-stop-daemon --start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc/${NAME}.conf $PIDFILE
51
49
-        echo "$NAME."
52
50
-        ;;
53
51
-    stop)
67
65
-        start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
68
66
-        rm -f $PIDFILE
69
67
-        sleep 1
70
 
-        start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
 
68
-        start-stop-daemon --start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc/${NAME}.conf $PIDFILE
71
69
-        echo "$NAME."
72
70
-        ;;
73
71
-    *)
77
75
-        exit 1
78
76
-        ;;
79
77
+  start)
80
 
+       echo -n "Starting $DESC: "
81
 
+  if [ $ENABLE_MEMCACHED = yes ]; then
82
 
+       start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
83
 
+       echo "$NAME."
84
 
+       else
85
 
+               echo "$NAME disabled in /etc/default/memcached."
86
 
+       fi
87
 
+       ;;
 
78
+       echo -n "Starting $DESC: "
 
79
+       if [ $ENABLE_MEMCACHED = yes ]; then
 
80
+            start-stop-daemon --start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc/${NAME}.conf $PIDFILE
 
81
+            echo "$NAME."
 
82
+       else
 
83
+            echo "$NAME disabled in /etc/default/memcached."
 
84
+       fi
 
85
+       ;;
88
86
+  stop)
89
 
+       echo -n "Stopping $DESC: "
90
 
+       start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
91
 
+       echo "$NAME."
92
 
+       rm -f $PIDFILE
93
 
+       ;;
 
87
+       echo -n "Stopping $DESC: "
 
88
+       start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON
 
89
+       echo "$NAME."
 
90
+       rm -f $PIDFILE
 
91
+       ;;
94
92
+
95
93
+  restart|force-reload)
96
 
+       #
97
 
+       #       If the "reload" option is implemented, move the "force-reload"
98
 
+       #       option to the "reload" entry above. If not, "force-reload" is
99
 
+       #       just the same as "restart".
100
 
+       #
101
 
+       echo -n "Restarting $DESC: "
102
 
+       start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
103
 
+       rm -f $PIDFILE
104
 
+       sleep 1
105
 
+       start-stop-daemon --start --quiet --exec $DAEMONBOOTSTRAP
106
 
+       echo "$NAME."
107
 
+       ;;
 
94
+       #
 
95
+       #       If the "reload" option is implemented, move the "force-reload"
 
96
+       #       option to the "reload" entry above. If not, "force-reload" is
 
97
+       #       just the same as "restart".
 
98
+       #
 
99
+       echo -n "Restarting $DESC: "
 
100
+       start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
 
101
+       rm -f $PIDFILE
 
102
+       if [ $ENABLE_MEMCACHED = yes ]; then
 
103
+                       sleep 1
 
104
+                       start-stop-daemon --start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc/${NAME}.conf $PIDFILE
 
105
+                       echo "$NAME."
 
106
+       else
 
107
+            echo "$NAME disabled in /etc/default/memcached."
 
108
+       fi
 
109
+       ;;
108
110
+  status)
109
 
+       status_of_proc $DAEMON $NAME
110
 
+       ;;
 
111
+       status_of_proc -p $PIDFILE $DAEMON $NAME  && exit 0 || exit $?
 
112
+       ;;
111
113
+  *)
112
114
+       N=/etc/init.d/$NAME
113
115
+       echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
114
116
+       exit 1
115
117
+       ;;
116
118
 esac
 
119
 done;
117
120
 
118
 
 exit 0