#!/bin/bash smbstart() { for i in nmb smb winbind do service $i start done } smbstop() { cd /etc/samba net conf list | sed -r -e '2,/^\[.*\]$/ s/^$/\tinclude = registry\n/' > /etc/samba/mod-net-conf-list.conf mv smb.conf smb.conf.old mv mod-net-conf-list.conf smb.conf for i in winbind smb nmb do service $i stop done } clustop() { smbstop service ctdb stop } clustart() { service ctdb start smbstart } cluping() { echo "NMBD ping:" smbcontrol nmbd ping echo "SMBD ping:" smbcontrol smbd ping echo "WINBIND ping:" smbcontrol winbindd ping echo "CTDB ping:" ctdb ping } clustatus() { chksmb=`smbcontrol smbd ping` echo "SMBD ping says: ${chksmb}" chkwin=`smbcontrol winbindd onlinestatus` echo "WINBIND: ${chkwin}" echo "CTDB: status says:" ctdb status echo "CTDB: uptime says:" ctdb uptime } smbdebug() { smbcontrol winbind debug $1 smbcontrol smbd debug $1 echo "Verified SMBD settings are:" smbcontrol smbd debuglevel echo "Verified WINBINDD settings are:" smbcontrol winbind debuglevel } case "$1" in start) smbstart ;; stop) smbstop ;; restart) smbstop smbstart ;; ping) cluping ;; status) clustatus; ;; setdebug) echo "Setting debug level to: $2" smbdebug "$2" ;; cluster) case "$2" in stop) clustop ;; start) clustart ;; status) clustatus ;; restart) clustop clustart clustatus ;; *) echo $"Usage: $0 $1 $2 {stop|start|restart|status}" exit 2 esac ;; *) echo $"Usage: $0 {start|stop|restart|ping|status|cluster}" exit 2 esac exit $?