wok view samba/stuff/etc/init.d/samba @ rev 16681

Create some /var/run/<dir> in /etc/init.d/<daemon> scritps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun May 18 20:24:07 2014 +0000 (2014-05-18)
parents 4aacc04ab774
children 7f188676b59c
line source
1 #!/bin/sh
2 # /etc/init.d/samba : Start, stop and restart Samba server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start Samba server at boot time, just put samba 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=Samba
12 DESC="Samba server"
13 SMBD=/usr/sbin/smbd
14 NMBD=/usr/sbin/nmbd
15 NMBPIDFILE=/var/run/samba/nmbd.pid
16 SMBPIDFILE=/var/run/samba/smbd.pid
18 [ -d /var/run/samba ] || mkdir -p /var/run/samba
19 case "$1" in
20 start)
21 if active_pidfile $SMBPIDFILE smbd ; then
22 echo "$NAME: $SMBD already running."
23 else
24 echo -n "Starting $DESC: $SMBD... "
25 $SMBD -D
26 status
27 fi
28 if active_pidfile $NMBPIDFILE nmbd ; then
29 echo "$NAME: $NMBD already running."
30 else
31 echo -n "Starting $DESC: $NMBD... "
32 $NMBD -D
33 status
34 fi
35 ;;
36 stop)
37 if ! active_pidfile $SMBPIDFILE smbd ; then
38 echo "$NAME: $SMBD is not running."
39 else
40 echo -n "Stopping $DESC: $SMBD... "
41 kill `cat $SMBPIDFILE`
42 status
43 fi
44 if ! active_pidfile $NMBPIDFILE nmbd ; then
45 echo "$NAME: $NMBD is not running."
46 else
47 echo -n "Stopping $DESC: $NMBD... "
48 kill `cat $NMBPIDFILE`
49 status
50 fi
51 ;;
52 restart)
53 $0 stop
54 $0 start
55 ;;
56 reload)
57 if ! active_pidfile $SMBPIDFILE smbd ; then
58 echo "$NAME is not running."
59 exit 1
60 fi
61 echo -n "Reloading $DESC: $SMBD... "
62 kill -HUP `cat $SMBPIDFILE`
63 status
64 ;;
65 *)
66 echo ""
67 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart!reload]"
68 echo ""
69 exit 1
70 ;;
71 esac
73 exit 0