Skip to content

Accept service unit name in mxstartups #1

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions mxservicectl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ function mxsrv_start_one() {

. ${cfg}

su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} start" &
case "${MX_SRV_SCRIPT}" in
*.service)
systemctl start "${MX_SRV_SCRIPT}"
;;
*)
su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} start" &
;;
esac

mv ${cfg}{,.r}

Expand All @@ -34,7 +41,14 @@ function mxsrv_stop_one() {

. ${cfg}

su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} stop" &
case "${MX_SRV_SCRIPT}" in
*.service)
systemctl stop "${MX_SRV_SCRIPT}"
;;
*)
su - ${MX_SRV_USER} -c "${MX_SRV_SCRIPT} stop" &
;;
esac

rm ${cfg}

Expand Down
2 changes: 1 addition & 1 deletion mxstartup-classic.service
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Unit]
Description=Mariux mxstartup classic
After=mxstartup-mxvip.service mxmount.service
After=mxstartup-mxvip.service mxmount.service nis.service
Requires=mxstartup-mxvip.service mxmount.service

[Service]
Expand Down
1 change: 0 additions & 1 deletion mxstartup-mxvip.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ExecStart=/usr/sbin/mxvipctl start
ExecStop=/usr/sbin/mxvipctl stop
RemainAfterExit=yes
StandardOutput=syslog
Restart=always

[Install]
WantedBy=multi-user.target
30 changes: 7 additions & 23 deletions mxstartup2mxconfig
Original file line number Diff line number Diff line change
Expand Up @@ -248,27 +248,10 @@ sub print_ips_cfg {

##############################################################################

sub walknetgroup {
my @ng;

&y(\@ng,@_);

sub y {
my ($ary,$m)=@_;
$_=`ypmatch $m netgroup 2>/dev/null`;
foreach ( split ) {
if (/\(/) {
s/[\(\),]//g;
push @$ary, $_;
} else {
foreach ( split ) {
&y($ary,$_);
}
}
}
}

return @ng;
sub hostconfig_list {
my $tag = shift;
$_=`/usr/sbin/hostconfig --list $tag 2>/dev/null`;
return ( split );
}


Expand All @@ -279,8 +262,9 @@ sub expand_hosts {

foreach my $host (@oh) {
if($host =~ /^\@(\S+)/) {
push @hosts, walknetgroup($1);
} elsif($host =~ /^(\/\S+)/) {
push @hosts, hostconfig_list($1);
}
elsif ($host =~ /^(\/\S+)/) {
next unless(-r $1);
push @hosts, expand_hosts(read_file($1));
} else {
Expand Down
8 changes: 4 additions & 4 deletions mxstartupctl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

remoteuser=molgen

while ! id ${remoteuser} >/dev/null 2>&1 ; do
echo >&2 "WARNING: Waiting for NIS (failed to resolve remote user ${remoteuser})"
sleep 1
done

case "${1}" in
start)
while ! id ${remoteuser} >/dev/null 2>&1 ; do
echo >&2 "WARNING: Waiting for NIS (failed to resolve remote user ${remoteuser})"
sleep 1
done
mxvipctl start $2
mxservicectl start $2
;;
Expand Down