Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEB] permit packaging on debian squeeze using sysvinit as dameon script
- Loading branch information
Showing
4 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#! /bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: thumbor | ||
# Required-Start: $remote_fs $syslog | ||
# Required-Stop: $remote_fs $syslog | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: Thumbor image manipulation service | ||
# Description: Thumbor is a Python service providing an HTTP GET API to manipulate images | ||
# This startup script launch as much as service as ports defined in /etc/default/thumbor | ||
### END INIT INFO | ||
|
||
|
||
PATH=/sbin:/usr/sbin:/bin:/usr/bin | ||
NAME=thumbor | ||
|
||
conffile=/etc/thumbor.conf | ||
keyfile=/etc/thumbor.key | ||
ip=0.0.0.0 | ||
port=8888 | ||
|
||
DAEMON=/usr/bin/$NAME | ||
DAEMON_ARGS="-c ${conffile} -i ${ip} -k ${keyfile}" | ||
PIDDIR=/var/run/$NAME | ||
USER=thumbor | ||
|
||
. /lib/lsb/init-functions | ||
|
||
# Exit if the package is not installed | ||
[ -x "$DAEMON" ] || exit 0 | ||
|
||
# Read configuration variable file if it is present | ||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME | ||
|
||
#Service must not be disabled | ||
if ! [ "$enabled" != "0" ] || [ "$force_start" = "1" ]; then | ||
echo "Thumbor service is desabled by /etc/default/$NAME" | ||
exit 0 | ||
fi | ||
|
||
# | ||
# Function that starts the daemon/service | ||
# | ||
do_start() | ||
{ | ||
mkdir -p $PIDDIR | ||
#Loop on all conf for ports | ||
for p in `echo $port | tr ',' ' '`; do | ||
start-stop-daemon --start --quiet -b -m -c $USER --pidfile $PIDDIR/$p.pid --exec $DAEMON -- $DAEMON_ARGS -p $p || return 2 | ||
done | ||
} | ||
|
||
# | ||
# Function that stops the daemon/service | ||
# | ||
do_stop() | ||
{ | ||
ret=0 | ||
#Loop on all pids available | ||
for i in $PIDDIR/*.pid; do | ||
if [ -e $i ]; then | ||
kill `cat $i` | ||
if [ $? -ne 0 ]; then | ||
ret=$? | ||
fi | ||
rm -f $i | ||
fi | ||
done | ||
if [ "$ret" != 0 ]; then | ||
return 1 | ||
fi | ||
} | ||
|
||
case "$1" in | ||
start) | ||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" | ||
do_start | ||
case "$?" in | ||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; | ||
*) [ "$VERBOSE" != no ] && log_end_msg 1 ;; | ||
esac | ||
;; | ||
stop) | ||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" | ||
do_stop | ||
case "$?" in | ||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; | ||
*) [ "$VERBOSE" != no ] && log_end_msg 1 ;; | ||
esac | ||
;; | ||
status) | ||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? | ||
;; | ||
restart|force-reload) | ||
# | ||
# If the "reload" option is implemented then remove the | ||
# 'force-reload' alias | ||
# | ||
log_daemon_msg "Restarting $DESC" "$NAME" | ||
do_stop | ||
case "$?" in | ||
0|1) | ||
do_start | ||
case "$?" in | ||
0) log_end_msg 0 ;; | ||
1) log_end_msg 1 ;; # Old process is still running | ||
*) log_end_msg 1 ;; # Failed to start | ||
esac | ||
;; | ||
*) | ||
# Failed to stop | ||
log_end_msg 1 | ||
;; | ||
esac | ||
;; | ||
*) | ||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 | ||
exit 3 | ||
;; | ||
esac | ||
|
||
: | ||
|
File renamed without changes.