File: init.d

package info (click to toggle)
pyicqt 0.8b-5
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,016 kB
  • ctags: 1,751
  • sloc: python: 11,539; sh: 177; makefile: 57; xml: 16
file content (68 lines) | stat: -rw-r--r-- 1,690 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#! /bin/bash
### BEGIN INIT INFO
# Provides:          PYICQT
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Should-Start:      $local_fs
# Should-Stop:       $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts ICQ transport for Jabber
# Description:       starts PyICQt which provides a gateway that allows Jabber users to communicate with their
#                    contacts on the ICQ Messenger network. It can connect to any Jabber server
#                    that supports the Connect component mechanism.  
### END INIT INFO

export PATH=/sbin:/bin:/usr/sbin:/usr/bin

. /lib/lsb/init-functions

NAME=pyicqt
DESC="ICQ transport for Jabber"

PIDDIR=/var/run/pyicqt
PIDFILE=$PIDDIR/$NAME.pid
USER=pyicqt
GROUP=pyicqt

SSD_OPTS="--pidfile=$PIDFILE --name=python --user=$USER"

DAEMON=/usr/bin/python
OPTIONS="/usr/share/pyicqt/PyICQt.py --config=/etc/pyicqt.conf.xml --background -o pid=$PIDFILE -o spooldir=/var/lib/pyicqt -d --log=/var/log/pyicqt/pyicqt.log"

test -f $DAEMON || exit 0

if test ! -e $PIDDIR; then
	mkdir $PIDDIR
	chown $USER:$GROUP $PIDDIR
fi

case "$1" in
start)
	log_daemon_msg "Starting $DESC" "$NAME"
	start-stop-daemon --start $SSD_OPTS --startas "$DAEMON" --chuid "$USER" -- $OPTIONS
	log_end_msg $?
	;;
stop)
	log_daemon_msg "Stopping $DESC" "$NAME"
	start-stop-daemon --stop $SSD_OPTS --retry 10
	log_end_msg $?
	;;
reload|force-reload)
	log_daemon_msg "Reloading $DESC" "$NAME"
	start-stop-daemon --stop $SSD_OPTS --signal HUP
	log_end_msg $?
	;;
restart)
	$0 stop
	$0 start
	;;
*)
	echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2
	exit 1
	;;
esac

exit 0

# vim: filetype=sh