rendered paste body#! /bin/sh# Copyright (c) 1999-2004 SuSE Linux AG, Nuernberg, Germany.# All rights reserved.## Author: Lars Mueller <lmuelle@suse.de>## /etc/init.d/smb# and its symbolic link# /usr/sbin/rcsmb#### BEGIN INIT INFO# Provides: smb# Required-Start: $network $remote_fs $syslog# Should-Start: cupsd winbind nmb# Required-Stop: $network $remote_fs $syslog# Should-Stop: cupsd winbind nmb# Default-Start: 3 5# Default-Stop: 0 1 2 6# Short-Description: Samba SMB/CIFS file and print server# Description: Samba SMB/CIFS file and print server### END INIT INFOSMBD_BIN="/usr/sbin/smbd"SMB_CONF="/etc/samba/smb.conf"PID_FILE="/var/run/samba/smbd.pid". /etc/rc.statusrc_reset# Check for missing binaryif [ ! -x ${SMBD_BIN} ]; then echo -n >&2 "Samba SMB daemon, ${SMBD_BIN} is not installed. " rc_status -s exit 5fi# be extra carefull cause connection fail if TMPDIR is not writeableexport TMPDIR="/var/tmp"test -f /etc/sysconfig/samba && \ . /etc/sysconfig/sambafor setting in $SAMBA_SMBD_ENV; do pathcheck="${setting%%:*}" variable="${setting##*:}" test "${pathcheck}" != "${variable}" -a ! -e "${pathcheck}" && \ continue export eval ${variable}donecase "$1" in start) echo -n "Starting Samba SMB daemon " if [ ! -f ${SMB_CONF} ]; then echo -n >&2 "Samba configuration file, ${SMB_CONF} does not exist. " rc_status -s exit 6 fi checkproc -p ${PID_FILE} ${SMBD_BIN} case $? in 0) echo -n "- Warning: daemon already running. " ;; 1) echo -n "- Warning: ${PID_FILE} exists. " ;; esac test -f /etc/sysconfig/language && \ . /etc/sysconfig/language export LC_ALL="$RC_LC_ALL" export LC_CTYPE="$RC_LC_CTYPE" export LANG="$RC_LANG" startproc -p ${PID_FILE} ${SMBD_BIN} -D -s ${SMB_CONF} unset LC_ALL LC_CTYPE LANG rc_status -v ;; stop) echo -n "Shutting down Samba SMB daemon " checkproc -p ${PID_FILE} ${SMBD_BIN} || \ echo -n " Warning: daemon not running. " killproc -p ${PID_FILE} -t 10 ${SMBD_BIN} rc_status -v ;; try-restart|condrestart) if test "$1" = "condrestart"; then echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" fi $0 status if test $? = 0; then $0 restart else rc_reset fi rc_status ;; restart) $0 stop $0 start rc_status ;; force-reload|reload) echo -n "Reloading Samba SMB daemon " checkproc -p ${PID_FILE} ${SMBD_BIN} && \ touch ${PID_FILE} || \ echo -n >&2 " Warning: daemon not running. " killproc -p ${PID_FILE} -HUP ${SMBD_BIN} rc_status -v ;; status) echo -n "Checking for Samba SMB daemon " checkproc -p ${PID_FILE} ${SMBD_BIN} rc_status -v ;; probe) test ${SMB_CONF} -nt ${PID_FILE} && echo reload ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" exit 1 ;;esacrc_exit