summaryrefslogtreecommitdiffstats
path: root/packaging/LSB/samba.sh
blob: 99fa1b0117d82fcf067e5d20baa33d50d517637c (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
#
# "$Id: samba.sh,v 1.2 2001/07/03 01:01:12 jra Exp $"
#
# SAMBA startup (init) script for LSB-compliant systems.
#
# Provides: smbd nmbd
# Required-Start: 3 5
# Required-Stop: 0 2 1 6
# Default-Start: 3 5
# Default-Stop: 0 2 1 6
# Description: Starts and stops the SAMBA smbd and nmbd daemons \
#              used to provide SMB network services.
# 

# Source LSB function library.
. /lib/lsb/init-functions

# Check that smb.conf exists.
if test ! -f /etc/samba/smb.conf; then
	log_failure_msg "The smb.conf file does not exist."
	exit 6
fi

# Make sure that smbd and nmbd exist...
if test ! -f /usr/sbin/nmbd -o ! -f /usr/sbin/smbd; then
	log_failure_msg "The nmbd and/or smbd daemons are not installed."
	exit 5
fi

# See how we were called.
case "$1" in
	start)
		start_daemon nmbd -D 
		start_daemon smbd -D 	
		log_success_msg "Started SMB services."
		;;

	stop)
		killproc smbd
		killproc nmbd
		log_success_msg "Shutdown SMB services."
		;;

	reload)
		# smbd and nmbd automatically re-read the smb.conf file...
		log_success_msg "Reload not necessary with SAMBA."
		;;

	status)
		if test -z "`pidofproc smbd`"; then
			log_success_msg "smbd is not running."
		else
			log_success_msg "smbd is running."
		fi
		if test -z "`pidofproc nmbd`"; then
			log_success_msg "nmbd is not running."
		else
			log_success_msg "nmbd is running."
		fi
		;;


	restart | force-reload)
		$0 stop
		$0 start
		;;

	*)
		echo "Usage: smb {start|stop|reload|force-reload|restart|status}"
		exit 1
		;;
esac

# Return "success"
exit 0

#
# End of "$Id: samba.sh,v 1.2 2001/07/03 01:01:12 jra Exp $".
#