Browse code

pkg/deb: add jessie, wheezy and precise distributions

Victor Seva authored on 07/04/2014 15:08:13
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,108 @@
1
+#! /bin/sh
2
+### BEGIN INIT INFO
3
+# Provides:          sems
4
+# Required-Start:    $local_fs $remote_fs $network $syslog
5
+# Required-Stop:     $local_fs $remote_fs $network $syslog
6
+# Default-Start:     2 3 4 5
7
+# Default-Stop:      0 1 6
8
+# Short-Description: Start/stop SEMS Application Server
9
+### END INIT INFO
10
+
11
+. /lib/lsb/init-functions
12
+
13
+# read configuration from /etc/default/sems file
14
+if test -f /etc/default/sems ; then
15
+  . /etc/default/sems
16
+fi
17
+
18
+
19
+if test "$SEMS_RUN" = "no" ; then
20
+    log_failure_msg "Sems start disabled by default file"
21
+    exit 0
22
+fi
23
+
24
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
25
+DAEMON=/usr/sbin/sems
26
+NAME=sems
27
+DESC=sems
28
+
29
+PARAMS=""
30
+
31
+if ! test -d $SEMS_RUNDIR ; then
32
+   mkdir $SEMS_RUNDIR
33
+fi
34
+chown $SEMS_USER:$SEMS_GROUP $SEMS_RUNDIR
35
+
36
+if test "$SEMS_PIDFILE" ; then
37
+  PARAMS="$PARAMS -P $SEMS_PIDFILE"
38
+fi
39
+
40
+if test "$SEMS_USER" ; then
41
+  PARAMS="$PARAMS -u $SEMS_USER"
42
+fi
43
+
44
+if test "$SEMS_GROUP" ; then
45
+  PARAMS="$PARAMS -g $SEMS_GROUP"
46
+fi
47
+
48
+if test "$SEMS_CFG_FILE" ; then
49
+  PARAMS="$PARAMS -f $SEMS_CFG_FILE"
50
+  CFGPARAMS="-f $SEMS_CFG_FILE"
51
+fi
52
+
53
+if test "$SEMS_CREATE_CORE" = "yes" ; then
54
+	# directory for the core dump files
55
+	[ -d $SEMS_COREDIR ] || mkdir $SEMS_COREDIR
56
+	chmod 777 $SEMS_COREDIR
57
+	echo "$SEMS_COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
58
+	echo 2 > /proc/sys/fs/suid_dumpable
59
+	ulimit -c unlimited
60
+fi
61
+
62
+# raise file descriptors limit - call hold consumes two fds for RTP ports and one for moh file
63
+ulimit -n 100000
64
+
65
+if ! test -f $DAEMON ; then
66
+  log_failure_msg "Error: cannot find $DAEMON"
67
+  exit 1
68
+fi
69
+
70
+LD_LIBRARY_PATH=/usr/lib/sems
71
+export LD_LIBRARY_PATH
72
+
73
+set -e
74
+
75
+case "$1" in
76
+  start)
77
+	log_daemon_msg "Starting $DESC: $NAME "
78
+	start-stop-daemon --start --quiet --oknodo --pidfile $SEMS_PIDFILE \
79
+		--exec $DAEMON -- $PARAMS
80
+	log_end_msg $?
81
+	;;
82
+  stop)
83
+	log_daemon_msg "Stopping $DESC: $NAME "
84
+	start-stop-daemon --oknodo --stop --quiet --pidfile $SEMS_PIDFILE \
85
+		--exec $DAEMON
86
+	log_end_msg $?
87
+	;;
88
+  restart|force-reload)
89
+	log_daemon_msg "Restarting $DESC: $NAME "
90
+	start-stop-daemon --oknodo --stop --quiet --pidfile \
91
+		$SEMS_PIDFILE --exec $DAEMON
92
+	sleep 5
93
+	start-stop-daemon --start --quiet --pidfile \
94
+		$SEMS_PIDFILE --exec $DAEMON  -- $PARAMS
95
+	echo "."
96
+	;;
97
+  status)
98
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
99
+       ;;
100
+  *)
101
+	N=/etc/init.d/$NAME
102
+	echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
103
+	exit 1
104
+	;;
105
+esac
106
+
107
+exit 0
108
+