[Samba] Samba4 Ubuntu Init Scripts

Aaron E. ssureshot at gmail.com
Fri Apr 1 11:13:34 MDT 2011


here's one I put together and it works pretty good. I took parts from 
various net research and came up with this, I have since gathered a 
better understanding and probably should rewrite it without the killall 
statement but Ill save that for another day..

Edit paths accordingly..

#! /bin/bash -e
### BEGIN INIT INFO
# Provides:          samba
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Samba
# Description:       Samba Domain controller
#                    scheduler
### END INIT INFO
#
#
#
set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/local/samba1/sbin/samba

test -x $DAEMON || exit 0

case "$1" in
    start)
         echo -ne "Starting Samba" "samba \n"
         $DAEMON -D
       ;;
     stop)
         echo -ne "Stopping Samba" "samba \n"
         PIDSMB=`ps -e | grep samba | awk '{ print $1 }'`
         killall samba
       ;;
     restart)
         $0 stop
         echo -ne "Sleeping 5 Seconds Before Start: \n"
         sleep 5
         $0 start
    ;;
  *)
    echo "Usage: /etc/init.d/samba {start|stop|restart)"
    exit 1
    ;;
esac

exit 0



On 04/01/2011 12:43 PM, Ryan Leimenstoll wrote:
> Hello all,
>        I was wondering if anyone has developed an init script for Samba4
> Alpha14. I am using alpha 12 right now (from APT), but I would like to
> upgrade to Alpha14. Since Samba4 from GIT doesn't come with an init script,
> I have been unable to upgrade.
>
> Thanks!



More information about the samba mailing list