summaryrefslogtreecommitdiffstats
path: root/package/samba/S91smb
blob: c190771b7de280cdf5c8b26c61d9d6f5b33ffd9e (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
#
# Stolen from RedHat FC5.
#

# Check that smb.conf exists.
[ -f /etc/samba/smb.conf ] || exit 0

# Make directories.
mkdir -p /var/cache/samba
mkdir -p /var/log/samba
mkdir -p /var/lock/subsys

RETVAL=0

start() {
	echo -n "Starting SMB services: "
	smbd -D
	RETVAL=$?
	echo "done"

	echo -n "Starting NMB services: "
	nmbd -D
	RETVAL2=$?
	echo "done"

	[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/smb || \
	   RETVAL=1
	return $RETVAL
}	

stop() {
	echo -n "Shutting down SMB services: "
	kill -9 `pidof smbd`
	RETVAL=$?
	rm -f /var/run/smbd.pid
	echo "done"

	echo -n "Shutting down NMB services: "
	kill -9 `pidof nmbd`
	RETVAL2=$?
	rm -f /var/run/nmbd.pid

	[ $RETVAL -eq 0 -a $RETVAL2 -eq 0 ] && rm -f /var/lock/subsys/smb
	echo "done"
	return $RETVAL
}	

restart() {
	stop
	start
}	

reload() {
        echo -n "Reloading smb.conf file: "
	kill -HUP `pidof smbd`
	RETVAL=$?
	echo "done"
	return $RETVAL
}	

case "$1" in
  start)
  	start
	;;
  stop)
  	stop
	;;
  restart)
  	restart
	;;
  reload)
  	reload
	;;
  *)
	echo "Usage: $0 {start|stop|restart|reload}"
	exit 1
esac

exit $?
OpenPOWER on IntegriCloud