This is a part of my Samba website. I can be reached under andrew.williams@gmx.net.
#! /bin/sh # # Kill and restart Samba # echo -n "Shutting down Samba: " killproc -TERM /usr/sbin/nmbd killproc -TERM /usr/sbin/smbd echo echo -n "Hit XMIT to delete logs and restart" read rm /var/log/samba/log.* echo -n "Restarting Samba " /usr/sbin/nmbd -D /usr/sbin/smbd -D echo " done"As you will see, it also kills the logfiles left by the previous version. You may have to change some names because your Samba executables and logfiles are likely to be somewhere else.
The 2 lines:
echo -n "Hit XMIT to delete logs and restart" and readare there because I sometimes want to change something while Samba is down.
As an alternative under Linux, you could try the two lines:
killall -HUP smbd(from Michael Maclean) although these do not delete the logfiles.
killall -HUP nmbd
#!/usr/bin/perl -w # # This work of art copies the Samba man-pages from $base_man to # $dest_man, copies that were previously in the @rm_man directories # are deleted. # As Is, it is tailored for SuSE. It may well work under on other # systems (with Perl) but USE IT ENTIRELY AT YOUR OWN RISK! # (This was my second-ever Perl script so be tolerant)
use strict; use File::Copy;
my (@base_sub, @base_top, @del_list, @rm_man, $cp, $i, $base, $bsub, $del, $rm); # my $base_man = "/usr/local/samba/man"; # copy from here my $dest_man = "/usr/local/man"; # to beneath here my @rm_in = ("/usr/share/man","/usr/share/man/allman"); # delete beneath here # As far as I know, /usr/share/man/allman only existed under SuSE # # Check that the directories actually exist. Insist on $base_man, # $dest_man and at least one @rm_man value. # if (! (-d $dest_man)) { die "Could not find $dest_man ($!)"; } foreach $i (@rm_in) { if (-d $i) { push @rm_man, $i; } else { print "Directory $i does not exist, ignored\n"; } } if (@rm_man == 0) { die "Could not find any of: @rm_in - $!"; } chdir($base_man) || die "Could not get to $base_man ($!)"; opendir BASE_MAN, $base_man; @base_top = grep !/^\.\.?$/, readdir BASE_MAN; closedir BASE_MAN; # # Loop through /$base_man looking for subdirectories # foreach $base (@base_top) { opendir BASE_SUB, $base_man."/".$base; @base_sub = grep !/^\.\.?$/, readdir BASE_SUB; closedir BASE_SUB; foreach $bsub (@base_sub) { $cp = "$base/$bsub"; foreach $rm (@rm_man) { @del_list = <$rm/$cp*>; if (@del_list != 0) { # print "unlink @del_list \n" ; # $del= unlink @del_list || print "rm @del_list Failed: $!\n"; $del = unlink @del_list ; if ($del == 0) {print "rm @del_list Failed: $!\n" }; } } copy("$base_man/$cp", "$dest_man/$cp") || print "cp $base_man/$cp $dest_man/$cp Failed: $!\n"; } }