| 1 | #!/bin/sh
|
|---|
| 2 | #
|
|---|
| 3 | # "$Id: samba.sh,v 1.2 2001/07/03 01:01:12 jra Exp $"
|
|---|
| 4 | #
|
|---|
| 5 | # SAMBA startup (init) script for LSB-compliant systems.
|
|---|
| 6 | #
|
|---|
| 7 | # Provides: smbd nmbd
|
|---|
| 8 | # Required-Start: 3 5
|
|---|
| 9 | # Required-Stop: 0 2 1 6
|
|---|
| 10 | # Default-Start: 3 5
|
|---|
| 11 | # Default-Stop: 0 2 1 6
|
|---|
| 12 | # Description: Starts and stops the SAMBA smbd and nmbd daemons \
|
|---|
| 13 | # used to provide SMB network services.
|
|---|
| 14 | #
|
|---|
| 15 |
|
|---|
| 16 | # Source LSB function library.
|
|---|
| 17 | . /lib/lsb/init-functions
|
|---|
| 18 |
|
|---|
| 19 | # Check that smb.conf exists.
|
|---|
| 20 | if test ! -f /etc/samba/smb.conf; then
|
|---|
| 21 | log_failure_msg "The smb.conf file does not exist."
|
|---|
| 22 | exit 6
|
|---|
| 23 | fi
|
|---|
| 24 |
|
|---|
| 25 | # Make sure that smbd and nmbd exist...
|
|---|
| 26 | if test ! -f /usr/sbin/nmbd -o ! -f /usr/sbin/smbd; then
|
|---|
| 27 | log_failure_msg "The nmbd and/or smbd daemons are not installed."
|
|---|
| 28 | exit 5
|
|---|
| 29 | fi
|
|---|
| 30 |
|
|---|
| 31 | # See how we were called.
|
|---|
| 32 | case "$1" in
|
|---|
| 33 | start)
|
|---|
| 34 | start_daemon nmbd -D
|
|---|
| 35 | start_daemon smbd -D
|
|---|
| 36 | log_success_msg "Started SMB services."
|
|---|
| 37 | ;;
|
|---|
| 38 |
|
|---|
| 39 | stop)
|
|---|
| 40 | killproc smbd
|
|---|
| 41 | killproc nmbd
|
|---|
| 42 | log_success_msg "Shutdown SMB services."
|
|---|
| 43 | ;;
|
|---|
| 44 |
|
|---|
| 45 | reload)
|
|---|
| 46 | # smbd and nmbd automatically re-read the smb.conf file...
|
|---|
| 47 | log_success_msg "Reload not necessary with SAMBA."
|
|---|
| 48 | ;;
|
|---|
| 49 |
|
|---|
| 50 | status)
|
|---|
| 51 | if test -z "`pidofproc smbd`"; then
|
|---|
| 52 | log_success_msg "smbd is not running."
|
|---|
| 53 | else
|
|---|
| 54 | log_success_msg "smbd is running."
|
|---|
| 55 | fi
|
|---|
| 56 | if test -z "`pidofproc nmbd`"; then
|
|---|
| 57 | log_success_msg "nmbd is not running."
|
|---|
| 58 | else
|
|---|
| 59 | log_success_msg "nmbd is running."
|
|---|
| 60 | fi
|
|---|
| 61 | ;;
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 | restart | force-reload)
|
|---|
| 65 | $0 stop
|
|---|
| 66 | $0 start
|
|---|
| 67 | ;;
|
|---|
| 68 |
|
|---|
| 69 | *)
|
|---|
| 70 | echo "Usage: smb {start|stop|reload|force-reload|restart|status}"
|
|---|
| 71 | exit 1
|
|---|
| 72 | ;;
|
|---|
| 73 | esac
|
|---|
| 74 |
|
|---|
| 75 | # Return "success"
|
|---|
| 76 | exit 0
|
|---|
| 77 |
|
|---|
| 78 | #
|
|---|
| 79 | # End of "$Id: samba.sh,v 1.2 2001/07/03 01:01:12 jra Exp $".
|
|---|
| 80 | #
|
|---|