Subversion Repositories configs

Rev

Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/sh
2
#
3
# chkconfig: - 91 35
4
# description: Starts and stops the Samba nmbd daemon \
5
#	       used to provide NetBIOS name services.
6
#
7
# pidfile: /var/run/samba/nmbd.pid
8
# config:  /etc/samba/smb.conf
9
 
10
 
11
# Source function library.
12
if [ -f /etc/init.d/functions ] ; then
13
  . /etc/init.d/functions
14
elif [ -f /etc/rc.d/init.d/functions ] ; then
15
  . /etc/rc.d/init.d/functions
16
else
17
  exit 1
18
fi
19
 
20
# Avoid using root's TMPDIR
21
unset TMPDIR
22
 
23
# Source networking configuration.
24
. /etc/sysconfig/network
25
 
26
if [ -f /etc/sysconfig/samba ]; then
27
   . /etc/sysconfig/samba
28
fi
29
 
30
# Check that networking is up.
31
[ ${NETWORKING} = "no" ] && exit 1
32
 
33
# Check that smb.conf exists.
34
[ -f /etc/samba/smb.conf ] || exit 6
35
 
36
RETVAL=0
37
 
38
 
39
start() {
40
        KIND="NMB"
41
	echo -n $"Starting $KIND services: "
42
	daemon nmbd $NMBDOPTIONS
43
	RETVAL=$?
44
	echo
45
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nmb || \
46
	   RETVAL=1
47
	return $RETVAL
48
}
49
 
50
stop() {
51
	KIND="NMB"
52
	echo -n $"Shutting down $KIND services: "
53
	killproc nmbd
54
	RETVAL=$?
55
	echo
56
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/nmb
57
	return $RETVAL
58
}
59
 
60
restart() {
61
	stop
62
	start
63
}
64
 
65
reload() {
66
        echo -n $"Reloading smb.conf file: "
67
	killproc nmbd -HUP
68
	RETVAL=$?
69
	echo
70
	return $RETVAL
71
}
72
 
73
rhstatus() {
74
	status -l nmb nmbd
75
	return $?
76
}
77
 
78
 
79
# Allow status as non-root.
80
if [ "$1" = status ]; then
81
       rhstatus
82
       exit $?
83
fi
84
 
34 - 85
# Check that we are root ... so non-root users stop here
86
[  `id -u` -eq  "0" ] ||  exit 4
4 - 87
 
88
 
89
 
90
case "$1" in
91
  start)
92
  	start
93
	;;
94
  stop)
95
  	stop
96
	;;
97
  restart)
98
  	restart
99
	;;
100
  reload)
101
  	reload
102
	;;
103
  status)
104
  	rhstatus
105
	;;
106
  condrestart)
107
  	[ -f /var/lock/subsys/nmb ] && restart || :
108
	;;
109
  *)
110
	echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
111
	exit 2
112
esac
113
 
114
exit $?