wok view backuppc/stuff/etc/init.d/backuppc @ rev 18417

gimp, guichan: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Sep 21 10:02:55 2015 +0200 (2015-09-21)
parents
children 7f188676b59c
line source
1 #!/bin/sh
2 # /etc/init.d/backuppc: Start, stop and restart backuppc daemon on SliTaz, at boot
3 # time or with the command line.
4 #
5 # To start daemon at boot time, just put the right name in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf.
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=BackupPC
12 DESC="backuppc deamon"
13 DAEMON=/usr/bin/BackupPC
14 OPTIONS=$BACKUPPC_OPTIONS
15 [ -n "$OPTIONS" ] || OPTIONS="-d"
16 PIDFILE=/var/run/backuppc.pid
18 case "$1" in
19 start)
20 if active_pidfile $PIDFILE $NAME ; then
21 echo "$NAME already running."
22 exit 1
23 fi
24 echo -n "Starting $DESC: $NAME... "
25 su -s /bin/sh -c "$DAEMON $OPTIONS" www
26 pidof $NAME | awk '{ print $1 }' > $PIDFILE
27 status
28 ;;
29 stop)
30 if ! active_pidfile $PIDFILE $NAME ; then
31 echo "$NAME is not running."
32 exit 1
33 fi
34 echo -n "Stopping $DESC: $NAME... "
35 kill `cat $PIDFILE`
36 rm $PIDFILE
37 status
38 ;;
39 restart)
40 if ! active_pidfile $PIDFILE $NAME ; then
41 echo "$NAME is not running."
42 exit 1
43 fi
44 echo -n "Restarting $DESC: $NAME... "
45 kill `cat $PIDFILE`
46 rm $PIDFILE
47 sleep 2
48 su -c "$DAEMON $OPTIONS" www
49 pidof $NAME | awk '{ print $1 }' > $PIDFILE
50 status
51 ;;
52 reload)
53 kill -1 `cat $PIDFILE`
54 status
55 ;;
56 *)
57 echo ""
58 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
59 echo ""
60 exit 1
61 ;;
62 esac
64 exit 0