Initscript Debian Wheezy
Jan B Kinander
samba at kinander.nu
Mon Sep 3 13:11:43 MDT 2012
Wow, wonderful, it worked like a charm!
Thanks!
Yours sincerly,
Jan Blomqvist Kinander
Den den 3 september 2012 klockan 20:10 skrev "Gémes Géza"
<geza at kzsdabas.hu>:
> 2012-09-03 18:24 keltezéssel, Jan B Kinander írta:
> > Hi, I try to figure out how to autostart SAMBA4, (I'm a windows guy) I
> > understand that it's the init.d script in the wiki for debian that I
should
> > use and then have a symlink from the rcX.d that will do the trick,
however
> > when I run insserv to try to understand how things work I get the
following
> > lines spitted in my face, what does they mean and how can I solve them?
> >
> >
> > root at smbserv ~ $ insserv
> >
> > insserv: warning: script 'K01mountdisk' missing LSB tags and overrides
> > insserv: Script samba is broken: incomplete LSB comment.
> > insserv: missing `Provides:' entry: please add.
> > insserv: missing `Required-Start:' entry: please add even if empty.
> > insserv: missing `Required-Stop:' entry: please add even if empty.
> > insserv: missing `Default-Start:' entry: please add even if empty.
> > insserv: missing `Default-Stop:' entry: please add even if empty.
> > insserv: Default-Start undefined, assuming empty start runlevel(s) for
> > script `samba'
> > insserv: Default-Stop undefined, assuming empty stop runlevel(s) for
script
> > `samba'
> > insserv: warning: script 'mountdisk' missing LSB tags and overrides
> > insserv: fopen(.depend.stop): Permission denied
> >
> >
> >
> > Yours sincerely,
> >
> > Jan Blomqvist Kinander
> >
> Hi,
>
> I've "fixed" the wiki version to work on wheezy. Find it below.
> BTW. I also modified bind9 (I use dlz) and ntp startups, to require
> samba (Added samba to the required start and required stop lines of
them).
>
>
> Regards
>
> Geza Gemes
>
> #!/bin/sh
>
> ### BEGIN INIT INFO
> # Provides: samba
> # Required-Start: $network $local_fs $remote_fs
> # Required-Stop: $network $local_fs $remote_fs
> # Default-Start: 2 3 4 5
> # Default-Stop: 0 1 6
> # Should-Start: slapd
> # Should-Stop: slapd
> # Short-Description: start Samba daemon (samba)
> ### END INIT INFO
>
> PIDDIR=/usr/local/samba/var/run
> SAMBADPID=$PIDDIR/samba.pid
>
> # clear conflicting settings from the environment
> unset TMPDIR
>
> # See if the daemons are there
> test -x /usr/local/samba/sbin/samba || exit 0
>
> # Starting init-fuctions for Debian -shell script
> . /lib/lsb/init-functions
>
> case "$1" in
> start)
> log_daemon_msg "Starting Samba daemon"
> # Make sure we have our PIDDIR, even if it's on a tmpfs
> install -o root -g root -m 755 -d $PIDDIR
>
> SAMBA_DISABLED=`testparm -s --parameter-name='disable
> netbios' 2>/dev/null`
> if [ "$SAMBA_DISABLED" != 'Yes' ]; then
> log_progress_msg "samba"
> if ! start-stop-daemon --start --quiet --oknodo
> --exec /usr/local/samba/sbin/samba -- -D
> then
> log_end_msg 1
> exit 1
> fi
> fi
>
> log_end_msg 0
> ;;
> stop)
> log_daemon_msg "Stopping Samba daemon"
> log_progress_msg "samba"
>
> start-stop-daemon --stop --quiet --pidfile $SAMBADPID
> # Wait a little and remove stale PID file
> sleep 1
> if [ -f $SAMBADPID ] && ! ps h `cat $SAMBADPID` >
/dev/null
> then
> # Stale PID file (samba was succesfully
stopped),
> # remove it (should be removed by samba itself
> IMHO.)
> rm -f $SAMBADPID
> fi
>
> log_end_msg 0
>
> ;;
> reload)
> log_daemon_msg "Reloading /usr/local/samba/etc/smb.conf "
> start-stop-daemon --stop --signal HUP --pidfile
$SAMBADPID
> log_end_msg 0
> ;;
> restart|force-reload)
> $0 stop
> sleep 1
> $0 start
> ;;
> *)
> echo "Usage: /etc/init.d/samba4
> {start|stop|reload|restart|force-reload}"
> exit 1
> ;;
> esac
>
> exit 0
>
More information about the samba-technical
mailing list