/[smeserver]/rpms/samba/sme8/smb.init
ViewVC logotype

Contents of /rpms/samba/sme8/smb.init

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sat Feb 6 20:35:55 2010 UTC (14 years, 3 months ago) by slords
Branch: MAIN
CVS Tags: samba-3_4_3-1_1_el5_sme, HEAD
Initial import

1 #!/bin/sh
2 #
3 # chkconfig: - 91 35
4 # description: Starts and stops the Samba smbd daemon \
5 # used to provide SMB network services.
6 #
7 # pidfile: /var/run/samba/smbd.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 # Source auto-configure functions
21 [ -e /etc/init.d/functions-automagic ] && source /etc/init.d/functions-automagic
22 [ -e /etc/sysconfig/automagic ] && source /etc/sysconfig/automagic
23
24 # Avoid using root's TMPDIR
25 unset TMPDIR
26
27 # Source networking configuration.
28 . /etc/sysconfig/network
29
30 if [ -f /etc/sysconfig/samba ]; then
31 . /etc/sysconfig/samba
32 fi
33
34 # Check that networking is up.
35 [ ${NETWORKING} = "no" ] && exit 1
36
37 # Check that smb.conf exists.
38 [ -f /etc/samba/smb.conf ] || exit 6
39
40 RETVAL=0
41
42 automagic() {
43 # Bail if no-automagic is not wanted
44 if [ "$AUTOMAGIC" == "off" ]; then
45 return
46 fi
47
48 sed -i -e "s/^interfaces.*/interfaces = lo $AUTOMAGIC_LANIFS/" /etc/samba/smb.conf
49 sed -i -e "s/^bind interfaces only.*/bind interfaces only = yes/" /etc/samba/smb.conf
50 }
51
52 start() {
53 automagic
54 KIND="SMB"
55 echo -n $"Starting $KIND services: "
56 daemon smbd $SMBDOPTIONS
57 RETVAL=$?
58 echo
59 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb || \
60 RETVAL=1
61 return $RETVAL
62 }
63
64 stop() {
65 KIND="SMB"
66 echo -n $"Shutting down $KIND services: "
67 killproc smbd
68 RETVAL=$?
69 echo
70 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/smb
71 return $RETVAL
72 }
73
74 restart() {
75 stop
76 start
77 }
78
79 reload() {
80 echo -n $"Reloading smb.conf file: "
81 killproc smbd -HUP
82 RETVAL=$?
83 echo
84 return $RETVAL
85 }
86
87 rhstatus() {
88 status smbd
89 return $?
90 }
91
92
93 # Allow status as non-root.
94 if [ "$1" = status ]; then
95 rhstatus
96 exit $?
97 fi
98
99 # Check that we can write to it... so non-root users stop here
100 [ -w /etc/samba/smb.conf ] || exit 4
101
102
103
104 case "$1" in
105 start)
106 start
107 ;;
108 stop)
109 stop
110 ;;
111 restart)
112 restart
113 ;;
114 reload)
115 reload
116 ;;
117 status)
118 rhstatus
119 ;;
120 condrestart)
121 [ -f /var/lock/subsys/smb ] && restart || :
122 ;;
123 *)
124 echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
125 exit 2
126 esac
127
128 exit $?

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed