Ini telah ditulis untuk linux dan bash / perl. Saya menyimpannya di / root / bin dan memiliki izin 0700. Jika Anda menggunakannya, Anda melakukannya untuk kemudahan Anda sendiri dan risiko Anda sendiri. The command killproc is not universally available; killall seems to work in a similar fashion on some systems - although it apparently kills all processes on a Sun! Perintah killproc tidak universal tersedia; killall tampaknya bekerja dengan cara yang sama pada beberapa sistem - meskipun tampaknya membunuh semua proses.(mengapa ada orang yang ingin mengimplementasikan fungsi seperti itu?)
1.1. Menghentikan dan Restart Samba
#! /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"
Seperti yang akan Anda lihat, ia juga membunuh logfiles ditinggalkan oleh versi sebelumnya. Anda mungkin harus mengubah beberapa nama karena Samba logfiles executable dan cenderung berada di tempat lain.
The 2 lines:
echo -n "Hit XMIT to delete logs and restart"
and read
Sebagai alternatif di Linux, Anda dapat mencoba dua baris:
killall -HUP smbd
killall -HUP nmbd
1.2. Post-install
Hal ini berjalan setelah membuat installman atau make install dan diperlukan untuk setiap rilis baru. Ini biasanya hanya memberitahu bahwa "/ usr / man / Allman" tidak ada.
#!/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";
} }
0 komentar:
Posting Komentar