initial commit of file from CVS for e-smith-base on Thu 26 Oct 11:24:52 BST 2023
This commit is contained in:
39
root/etc/e-smith/events/actions/fix-startup
Normal file
39
root/etc/e-smith/events/actions/fix-startup
Normal file
@@ -0,0 +1,39 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use DirHandle;
|
||||
my $d = DirHandle->new("/etc/rc7.d");
|
||||
|
||||
my @d =
|
||||
sort { $a->{order} cmp $b->{order} }
|
||||
map { /^S(\d+)([\w\-.]+)/ ; { name => $2 , order => $1 } }
|
||||
grep { /^S/ } $d->read;
|
||||
|
||||
my $equivalent = {'oidentd'=> 'identd',
|
||||
'nut'=> 'ups',
|
||||
'raidmonitor' => 'mdmonitor'
|
||||
};
|
||||
|
||||
|
||||
foreach my $service (@d)
|
||||
{
|
||||
my $sv=$service->{'name'};
|
||||
next if $sv eq 'bootstrap-console';
|
||||
$sv= $equivalent->{$sv} || $sv;
|
||||
foreach (qw(multi-user sme-server))
|
||||
{
|
||||
if (-e "/lib/systemd/system/$_.target.wants/$sv.service")
|
||||
{
|
||||
system(qw(systemctl disable), $sv);
|
||||
}
|
||||
elsif (-e "/etc/systemd/system/$_.target.wants/$sv.service")
|
||||
{
|
||||
system(qw(systemctl disable), $sv);
|
||||
}
|
||||
elsif (-e "/etc/init.d/$sv")
|
||||
{
|
||||
my $dropoutput = `/usr/sbin/chkconfig $sv off 2>/dev/null`;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user