wok-6.x view perdition/stuff/etc/init.d/perdition @ rev 5645

Add: linux-configfs (Userspace-driven kernel object configuration)
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 28 23:38:40 2010 +0200 (2010-05-28)
parents e7b65e9636d8
children 7f188676b59c
line source
1 #!/bin/sh
2 # /etc/init.d/perdition : Start, stop and restart IMAP/POP3 proxy server
3 # on SliTaz, at boot time or with the command line.
4 #
5 # To start IMAP/POP3 proxy server at boot time, just put perdition in the
6 # $RUN_DAEMONS variable of /etc/rcS.conf and configure options with
7 # /etc/daemons.conf
8 #
9 . /etc/init.d/rc.functions
10 . /etc/daemons.conf
12 NAME=Perdition
13 DESC="IMAP/POP3 proxy server"
14 DAEMON=/usr/sbin/perdition
15 OPTIONS=$PERDITION_OPTIONS
16 PIDFILE=/var/run/perdition
17 PROTOCOLS="pop3 pop3s imap4 imap4s imaps"
18 [ -n "$OPTIONS" ] || OPTIONS="--group=nogroup"
20 case "$1" in
21 start)
22 for i in $PROTOCOLS; do
23 [ -s /etc/perdition/perdition.$i.conf ] || continue
24 if active_pidfile $PIDFILE.$i/perdition.$i.pid perdition.$i ; then
25 echo "$NAME ($i) already running."
26 continue
27 fi
28 echo -n "Starting $DESC: $NAME ($i)... "
29 $DAEMON.$i -f /etc/perdition/perdition.$i.conf $OPTIONS \
30 --pid_file $PIDFILE.$i/perdition.$i.pid
31 status
32 done
33 ;;
34 stop)
35 for i in $PROTOCOLS; do
36 [ -s /etc/perdition/perdition.$i.conf ] || continue
37 if ! active_pidfile $PIDFILE.$i/perdition.$i.pid perdition.$i ; then
38 echo "$NAME ($i) is not running."
39 continue
40 fi
41 echo -n "Stopping $DESC: $NAME ($i)... "
42 kill `cat $PIDFILE.$i/perdition.$i.pid`
43 status
44 done
45 ;;
46 restart)
47 for i in $PROTOCOLS; do
48 [ -s /etc/perdition/perdition.$i.conf ] || continue
49 if ! active_pidfile $PIDFILE.$i/perdition.$i.pid perdition.$i ; then
50 echo "$NAME ($i) is not running."
51 continue
52 fi
53 echo -n "Restarting $DESC: $NAME ($i)... "
54 kill `cat $PIDFILE.$i/perdition.$i.pid`
55 sleep 2
56 $DAEMON.$i -f /etc/perdition/perdition.$i.conf $OPTIONS \
57 --pid_file $PIDFILE.$i/perdition.$i.pid
58 status
59 done
60 ;;
61 reload)
62 for i in $PROTOCOLS; do
63 [ -s /etc/perdition/perdition.$i.conf ] || continue
64 active_pidfile $PIDFILE.$i/perdition.$i.pid perdition.$i && \
65 kill -1 `cat $PIDFILE.$i/perdition.$i.pid`
66 status
67 done
68 ;;
69 *)
70 echo ""
71 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart|reload]"
72 echo ""
73 exit 1
74 ;;
75 esac
77 exit 0