merged some fixes from trunk to here
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.6@10432 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
@@ -50,7 +50,7 @@ service node.
|
||||
|
||||
If the -i option is specified, the nodes themselves will not be modified.
|
||||
|
||||
If the -i option is NOT specified then the nodes will e modified as follows:
|
||||
If the -i option is NOT specified then the nodes will be modified as follows:
|
||||
|
||||
=over 3
|
||||
|
||||
@@ -68,6 +68,10 @@ The B<mkresolvconf> script will be run IF it was included in the nodes postscrip
|
||||
|
||||
=item 4.
|
||||
|
||||
The default gateway will be switched to the backup service node if B<networks.gateway=<xcatmaster>>.
|
||||
|
||||
=item 5.
|
||||
|
||||
If it is an AIX diskful node then the B<niminit> command will be run so that it will recognize the new service node as it's NIM master.
|
||||
|
||||
=back
|
||||
|
||||
@@ -156,9 +156,11 @@ To run the "syslog" script for the nodes, type:
|
||||
|
||||
updatenode <noderange> -P syslog
|
||||
|
||||
To run a list of scripts, type:
|
||||
To run a list of scripts, type:
|
||||
|
||||
updatenode <noderange> -P script1,script2
|
||||
updatenode <noderange> -P "script1 p1 p2,script2"
|
||||
|
||||
where p1 p2 are the parameters for script1.
|
||||
|
||||
The flag '-P' can be omitted when only postscripts parameters are
|
||||
specified.
|
||||
@@ -250,6 +252,11 @@ formats.
|
||||
A comma-separated list of script names.
|
||||
The scripts must be executable and copied
|
||||
to the /install/postscripts directory.
|
||||
Each script can take zero or more parameters.
|
||||
If parameters are spcified, the whole list needs to be quoted by double quotes.
|
||||
For example:
|
||||
|
||||
B<"script1 p1 p2,script2">
|
||||
|
||||
=item [B<attr=val> [B<attr=val...>]]
|
||||
|
||||
@@ -381,7 +388,7 @@ the synclist files specified in the osimage "synclists" attribute.
|
||||
|
||||
=item 2
|
||||
|
||||
To perform a software update and file synchronization only on the node
|
||||
To run postscripts and file synchronization only on the node
|
||||
"clstrn01":
|
||||
|
||||
B<updatenode clstrn01 -F -P>
|
||||
@@ -398,27 +405,29 @@ Run:
|
||||
|
||||
B<updatenode clstrn01 -F>
|
||||
|
||||
=item 3
|
||||
=item 4
|
||||
|
||||
To run the postscripts which indicated in the postscripts attribute on
|
||||
the node "clstrn01":
|
||||
|
||||
B<updatenode clstrn01 -P>
|
||||
|
||||
=item 4
|
||||
=item 5
|
||||
|
||||
To run the postscripts script1 and script2 on the node "clstrn01":
|
||||
|
||||
B<cp script1,script2 /install/postscripts>
|
||||
|
||||
B<updatenode clstrn01 -P script1,script2>
|
||||
B<updatenode clstrn01 -P "script1 p1 p2,script2">
|
||||
|
||||
Since flag '-P' can be omitted when only postscripts parameters are specified,
|
||||
the following command is equivalent:
|
||||
|
||||
B<updatenode clstrn01 script1,script2>
|
||||
B<updatenode clstrn01 "script1 p1 p2,script2">
|
||||
|
||||
=item 5
|
||||
p1 p2 are parameters for script1.
|
||||
|
||||
=item 6
|
||||
|
||||
To synchronize the files on the node "clstrn01": Prepare the synclist file.
|
||||
For AIX, set the full path of synclist in the osimage table synclists
|
||||
@@ -428,7 +437,7 @@ Then:
|
||||
|
||||
B<updatenode clstrn01 -F>
|
||||
|
||||
=item 6
|
||||
=item 7
|
||||
|
||||
To perform the software update on the Linux node "clstrn01": Copy the extra
|
||||
rpm into the /install/post/otherpkgs/<os>/<arch>/* and add the rpm names into
|
||||
@@ -436,7 +445,7 @@ the /install/custom/install/<ostype>/profile.otherpkgs.pkglist . Then:
|
||||
|
||||
B<updatenode clstrn01 -S>
|
||||
|
||||
=item 7
|
||||
=item 8
|
||||
|
||||
To update the AIX node named "xcatn11" using the "installp_bundle" and/or
|
||||
"otherpkgs" attribute values stored in the xCAT database. Use the default installp, rpm and emgr flags.
|
||||
@@ -447,20 +456,20 @@ Note: The xCAT "xcatn11" node definition points to an xCAT osimage definition
|
||||
which contains the "installp_bundle" and "otherpkgs" attributes as well as
|
||||
the name of the NIM lpp_source resource.
|
||||
|
||||
=item 8
|
||||
=item 9
|
||||
|
||||
To update the AIX node "xcatn11" by installing the "bos.cpr" fileset using
|
||||
the "-agQXY" installp flags. Also display the output of the installp command.
|
||||
|
||||
B<updatenode xcatn11 -V -S otherpkgs="bos.cpr" installp_flags="-agQXY">
|
||||
|
||||
=item 9
|
||||
=item 10
|
||||
|
||||
To uninstall the "bos.cpr" fileset that was installed in the previous example.
|
||||
|
||||
B<updatenode xcatn11 -V -S otherpkgs="bos.cpr" installp_flags="-u">
|
||||
|
||||
=item 10
|
||||
=item 11
|
||||
|
||||
To update the AIX nodes "xcatn11" and "xcatn12" with the "gpfs.base" fileset
|
||||
and the "rsync" rpm using the installp flags "-agQXY" and the rpm flags "-i --nodeps".
|
||||
@@ -469,31 +478,31 @@ B<updatenode xcatn11,xcatn12 -V -S otherpkgs="gpfs.base,R:rsync-2.6.2-1.aix5.1.p
|
||||
|
||||
Note: Using the "-V" flag with multiple nodes may result in a large amount of output.
|
||||
|
||||
=item 11
|
||||
=item 12
|
||||
|
||||
To uninstall the rsync rpm that was installed in the previous example.
|
||||
|
||||
B<updatenode xcatn11 -V -S otherpkgs="R:rsync-2.6.2-1" rpm_flags="-e">
|
||||
|
||||
=item 12
|
||||
=item 13
|
||||
|
||||
Update the AIX node "node01" using the software specified in the NIM "sslbnd" and "sshbnd" installp_bundle resources and the "-agQXY" installp flags.
|
||||
|
||||
B<updatenode node01 -V -S installp_bundle="sslbnd,sshbnd" installp_flags="-agQXY">
|
||||
|
||||
=item 13
|
||||
=item 14
|
||||
|
||||
To get a preview of what would happen if you tried to install the "rsct.base" fileset on AIX node "node42". (You must use the "-V" option to get the full output from the installp command.)
|
||||
|
||||
B<updatenode node42 -V -S otherpkgs="rsct.base" installp_flags="-apXY">
|
||||
|
||||
=item 14
|
||||
=item 15
|
||||
|
||||
To check what rpm packages are installed on the AIX node "node09". (You must use the "-c" flag so updatenode does not get a list of packages from the database.)
|
||||
|
||||
B<updatenode node09 -V -c -S rpm_flags="-qa">
|
||||
|
||||
=item 15
|
||||
=item 16
|
||||
|
||||
To install all software updates contained in the /images directory.
|
||||
|
||||
@@ -503,25 +512,25 @@ Note: Make sure the directory is exportable and that the permissions are set
|
||||
correctly for all the files. (Including the .toc file in the case of
|
||||
installp filesets.)
|
||||
|
||||
=item 16
|
||||
=item 17
|
||||
|
||||
Install the interim fix package located in the /efixes directory.
|
||||
|
||||
B<updatenode node29 -V -S -d /efixes otherpkgs=IZ38930TL0.120304.epkg.Z>
|
||||
|
||||
=item 17
|
||||
=item 18
|
||||
|
||||
To uninstall the interim fix that was installed in the previous example.
|
||||
|
||||
B<updatenode xcatsn11 -V -S -c emgr_flags="-r -L IZ38930TL0">
|
||||
|
||||
=item 18
|
||||
=item 19
|
||||
|
||||
To update the security keys for the node "node01"
|
||||
|
||||
B<updatenode node01 -k>
|
||||
|
||||
=item 19
|
||||
=item 20
|
||||
|
||||
To update the service nodes with the files to be synchronized to node group compute:
|
||||
|
||||
|
||||
@@ -606,106 +606,107 @@ sub process_request
|
||||
}
|
||||
} # end - for Linux system only
|
||||
|
||||
#
|
||||
# for both AIX and Linux systems
|
||||
#
|
||||
# setup the default gateway if the network.gateway=xcatmaster for the node
|
||||
my %nethash;
|
||||
my %ipmap=();
|
||||
my %gwhash=();
|
||||
my $nwtab=xCAT::Table->new("networks");
|
||||
if ($nwtab) {
|
||||
my @tmp1=$nwtab->getAllAttribs(('net','mask','gateway','mgtifname'));
|
||||
if (@tmp1 && (@tmp1 > 0)) {
|
||||
foreach my $nwitem (@tmp1) {
|
||||
my $gw=$nwitem->{'gateway'};
|
||||
if (!$gw) {
|
||||
next;
|
||||
}
|
||||
|
||||
chomp $gw;
|
||||
if ($gw ne '<xcatmaster>') {
|
||||
next;
|
||||
}
|
||||
|
||||
#now only handle the networks that has <xcatmaster> as the gateway
|
||||
my $NM = $nwitem->{'mask'};
|
||||
my $net=$nwitem->{'net'};
|
||||
my $ifname=$nwitem->{'mgtifname'};
|
||||
chomp $NM;
|
||||
chomp $net;
|
||||
chomp $ifname;
|
||||
#print "NM=$NM, net=$net, ifname=$ifname, nodes=@nodes\n";
|
||||
|
||||
# for each node - get the network info
|
||||
foreach my $node (@nodes)
|
||||
{
|
||||
# get, check, split the node IP
|
||||
my $IP = xCAT::NetworkUtils->getipaddr($node);
|
||||
chomp $IP;
|
||||
if (!$::IGNORE){
|
||||
#
|
||||
# for both AIX and Linux systems
|
||||
#
|
||||
# setup the default gateway if the network.gateway=xcatmaster for the node
|
||||
my %nethash;
|
||||
my %ipmap=();
|
||||
my %gwhash=();
|
||||
my $nwtab=xCAT::Table->new("networks");
|
||||
if ($nwtab) {
|
||||
my @tmp1=$nwtab->getAllAttribs(('net','mask','gateway','mgtifname'));
|
||||
if (@tmp1 && (@tmp1 > 0)) {
|
||||
foreach my $nwitem (@tmp1) {
|
||||
my $gw=$nwitem->{'gateway'};
|
||||
if (!$gw) {
|
||||
next;
|
||||
}
|
||||
|
||||
# check the entries of the networks table
|
||||
# - if the bitwise AND of the IP and the netmask gives you
|
||||
# the "net" name then that is the entry you want.
|
||||
if(xCAT::NetworkUtils->ishostinsubnet($IP, $NM, $net))
|
||||
chomp $gw;
|
||||
if ($gw ne '<xcatmaster>') {
|
||||
next;
|
||||
}
|
||||
|
||||
#now only handle the networks that has <xcatmaster> as the gateway
|
||||
my $NM = $nwitem->{'mask'};
|
||||
my $net=$nwitem->{'net'};
|
||||
my $ifname=$nwitem->{'mgtifname'};
|
||||
chomp $NM;
|
||||
chomp $net;
|
||||
chomp $ifname;
|
||||
#print "NM=$NM, net=$net, ifname=$ifname, nodes=@nodes\n";
|
||||
|
||||
# for each node - get the network info
|
||||
foreach my $node (@nodes)
|
||||
{
|
||||
my $newmaster=$newxcatmaster{$node};
|
||||
my $newmasterIP;
|
||||
if (exists($ipmap{$newmaster})) {
|
||||
$newmasterIP=$ipmap{$newmaster};
|
||||
} else {
|
||||
$newmasterIP = xCAT::NetworkUtils->getipaddr($newmaster);
|
||||
chomp($newmasterIP);
|
||||
$ipmap{$newmaster}=$newmasterIP;
|
||||
}
|
||||
$nethash{$node}{'gateway'}=$newmasterIP;
|
||||
$nethash{$node}{'net'} = $net;
|
||||
$nethash{$node}{'mask'} = $NM;
|
||||
$nethash{$node}{'mgtifname'} = $ifname;
|
||||
if ($newmasterIP) {
|
||||
if (exists($gwhash{$newmasterIP})) {
|
||||
my $pa=$gwhash{$newmasterIP};
|
||||
push (@$pa, $node);
|
||||
# get, check, split the node IP
|
||||
my $IP = xCAT::NetworkUtils->getipaddr($node);
|
||||
chomp $IP;
|
||||
|
||||
# check the entries of the networks table
|
||||
# - if the bitwise AND of the IP and the netmask gives you
|
||||
# the "net" name then that is the entry you want.
|
||||
if(xCAT::NetworkUtils->ishostinsubnet($IP, $NM, $net))
|
||||
{
|
||||
my $newmaster=$newxcatmaster{$node};
|
||||
my $newmasterIP;
|
||||
if (exists($ipmap{$newmaster})) {
|
||||
$newmasterIP=$ipmap{$newmaster};
|
||||
} else {
|
||||
$gwhash{$newmasterIP}=[$node];
|
||||
$newmasterIP = xCAT::NetworkUtils->getipaddr($newmaster);
|
||||
chomp($newmasterIP);
|
||||
$ipmap{$newmaster}=$newmasterIP;
|
||||
}
|
||||
$nethash{$node}{'gateway'}=$newmasterIP;
|
||||
$nethash{$node}{'net'} = $net;
|
||||
$nethash{$node}{'mask'} = $NM;
|
||||
$nethash{$node}{'mgtifname'} = $ifname;
|
||||
if ($newmasterIP) {
|
||||
if (exists($gwhash{$newmasterIP})) {
|
||||
my $pa=$gwhash{$newmasterIP};
|
||||
push (@$pa, $node);
|
||||
} else {
|
||||
$gwhash{$newmasterIP}=[$node];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (keys(%gwhash) > 0) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0]="Setting up the default routes on the nodes.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
foreach my $gw (keys %gwhash) {
|
||||
my $cmd="route add default gw"; #this is temporary,TODO, set perminant route on the nodes.
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
$cmd="route add default";
|
||||
}
|
||||
my $ret =
|
||||
xCAT::Utils->runxcmd(
|
||||
{
|
||||
command => ['xdsh'],
|
||||
node => $gwhash{$gw},
|
||||
arg => ["-v", "$cmd $gw"],
|
||||
},
|
||||
$sub_req, -1, 1
|
||||
);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
my $rsp;
|
||||
$rsp->{data}=$ret;
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
if (keys(%gwhash) > 0) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0]="Setting up the default routes on the nodes.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
foreach my $gw (keys %gwhash) {
|
||||
my $cmd="route add default gw"; #this is temporary,TODO, set perminant route on the nodes.
|
||||
if (xCAT::Utils->isAIX()) {
|
||||
$cmd="route add default";
|
||||
}
|
||||
my $ret =
|
||||
xCAT::Utils->runxcmd(
|
||||
{
|
||||
command => ['xdsh'],
|
||||
node => $gwhash{$gw},
|
||||
arg => ["-v", "$cmd $gw"],
|
||||
},
|
||||
$sub_req, -1, 1
|
||||
);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
my $rsp;
|
||||
$rsp->{data}=$ret;
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# run postscripts to take care of syslog, ntp, and mkresolvconf
|
||||
# - if they are included in the postscripts table
|
||||
if (!$::IGNORE) # unless the user does not want us to touch the node
|
||||
|
||||
@@ -467,17 +467,21 @@ sub preprocess_updatenode
|
||||
my @MNip = xCAT::Utils->determinehostname;
|
||||
my @sns = ();
|
||||
foreach my $s (keys %$sn) {
|
||||
if (!grep (/^$s$/, @MNip)) {
|
||||
push @sns, $s;
|
||||
}
|
||||
my @tmp_a=split(',',$s);
|
||||
foreach my $s1 (@tmp_a) {
|
||||
if (!grep (/^$s1$/, @MNip)) {
|
||||
push @sns, $s1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scalar(@sns) && $::SECURITY) {
|
||||
|
||||
|
||||
$::CALLBACK = $callback;
|
||||
$::NODEOUT = ();
|
||||
|
||||
# setup the ssh keys
|
||||
my $req_sshkey = {%$request};
|
||||
my $req_sshkey = {%$request};
|
||||
$req_sshkey->{node} = \@sns;
|
||||
$req_sshkey->{security}->[0] = "yes";
|
||||
if ($::USER) {
|
||||
@@ -535,22 +539,27 @@ sub preprocess_updatenode
|
||||
# build each request for each service node
|
||||
foreach my $snkey (keys %$sn)
|
||||
{
|
||||
if ($::SECURITY
|
||||
&& !(grep /^$snkey$/, @good_sns)
|
||||
&& !(grep /^$snkey$/, @MNip)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The security update for service node $snkey encountered error, update security for following nodes will be skipped: @{$sn->{$snkey}}";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
|
||||
# remove the service node which have been handled before
|
||||
if ($::SECURITY && (grep /^$snkey$/, @MNip)) {
|
||||
delete @{$sn->{$snkey}}[@sns];
|
||||
if (scalar(@{$sn->{$snkey}}) == 0) {
|
||||
next;
|
||||
}
|
||||
}
|
||||
my @tmp_a=split(',',$s);
|
||||
foreach my $s1 (@tmp_a) {
|
||||
if ($::SECURITY
|
||||
&& !(grep /^$s1$/, @good_sns)
|
||||
&& !(grep /^$s1$/, @MNip)) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "The security update for service node $snkey encountered error, update security for following nodes will be skipped: @{$sn->{$snkey}}";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
next;
|
||||
}
|
||||
|
||||
# remove the service node which have been handled before
|
||||
if ($::SECURITY && (grep /^$s1$/, @MNip)) {
|
||||
delete @{$sn->{$snkey}}[@sns];
|
||||
if (scalar(@{$sn->{$snkey}}) == 0) {
|
||||
next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my $reqcopy = {%$request};
|
||||
$reqcopy->{node} = $sn->{$snkey};
|
||||
@@ -1052,11 +1061,11 @@ $AIXnodes_nd, $subreq ) != 0 ) {
|
||||
}
|
||||
my $args1;
|
||||
if ($::SETSERVER) {
|
||||
$args1 = ["-s", "-v", "-e", "$installdir/postscripts/xcatdsklspost $mode -M $snkey $postscripts"];
|
||||
$args1 = ["-s", "-v", "-e", "$installdir/postscripts/xcatdsklspost $mode -M $snkey '$postscripts'"];
|
||||
|
||||
} else {
|
||||
|
||||
$args1 = ["-s", "-v", "-e", "$installdir/postscripts/xcatdsklspost $mode -m $snkey $postscripts"];
|
||||
$args1 = ["-s", "-v", "-e", "$installdir/postscripts/xcatdsklspost $mode -m $snkey '$postscripts'"];
|
||||
}
|
||||
|
||||
|
||||
@@ -1125,9 +1134,9 @@ $AIXnodes_nd, $subreq ) != 0 ) {
|
||||
}
|
||||
|
||||
if ($::SETSERVER) {
|
||||
$cmd = "XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -v -e $installdir/postscripts/xcataixpost -M $snkey -c $mode $postscripts 2>&1";
|
||||
$cmd = "XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -v -e $installdir/postscripts/xcataixpost -M $snkey -c $mode '$postscripts' 2>&1";
|
||||
} else {
|
||||
$cmd = "XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -v -e $installdir/postscripts/xcataixpost -m $snkey -c $mode $postscripts 2>&1";
|
||||
$cmd = "XCATBYPASS=Y $::XCATROOT/bin/xdsh $nodestring -s -v -e $installdir/postscripts/xcataixpost -m $snkey -c $mode '$postscripts' 2>&1";
|
||||
}
|
||||
|
||||
if ($::VERBOSE)
|
||||
|
||||
+17
-15
@@ -15,7 +15,7 @@ op=$1
|
||||
net=$2
|
||||
mask=$3
|
||||
gw=$4
|
||||
if [[ -n "$5" ]]; then
|
||||
if [ -n "$5" ]; then
|
||||
ifname=$5
|
||||
fi
|
||||
|
||||
@@ -27,19 +27,21 @@ route_exists()
|
||||
gw=$3
|
||||
ret=0
|
||||
|
||||
if [[ -n "$4" ]]; then
|
||||
if [ -n "$4" ]; then
|
||||
ifname=$4
|
||||
fi
|
||||
|
||||
os_type=$(uname -s)
|
||||
|
||||
result=`netstat -nr|grep $net`;
|
||||
if [ $? -eq 0 ] && [ -n "$result" ]; then
|
||||
for x in `echo "$result"|tr -s " " ","`
|
||||
do
|
||||
if [[ $OSTYPE = linux* ]]; then
|
||||
if [ "$os_type" = "Linux" ]; then
|
||||
net1=`echo $x|cut -d',' -f1`
|
||||
gw1=`echo $x|cut -d',' -f2`
|
||||
mask1=`echo $x|cut -d',' -f3`
|
||||
if [[ "$net" == "$net1" ]] && [[ "$mask" == "$mask1" ]] && [[ "$gw" == "$gw1" ]]; then
|
||||
if [ "$net" = "$net1" ] && [ "$mask" = "$mask1" ] && [ "$gw" = "$gw1" ]; then
|
||||
ret=1
|
||||
break
|
||||
fi
|
||||
@@ -52,17 +54,17 @@ route_exists()
|
||||
n3=`echo $net |cut -d'.' -f3`
|
||||
n4=`echo $net |cut -d'.' -f4`
|
||||
|
||||
let "netnum = $(( $n1 << 24 )) + $(( $n2 << 16 )) + $(( $n3 << 8 )) + $n4"
|
||||
netnum="$(( ($n1 << 24) + ($n2 << 16) + ($n3 << 8) + $n4 ))"
|
||||
bits=32
|
||||
while [ `expr $netnum % 2` -eq 0 ]
|
||||
do
|
||||
let "bits = $bits -1"
|
||||
let "netnum = $netnum >> 1"
|
||||
bits="$(( $bits - 1 ))"
|
||||
netnum="$(( $netnum >> 1 ))"
|
||||
done
|
||||
|
||||
tmp2="$net/$bits";
|
||||
#echo "$tmp2=$tmp2"
|
||||
if [[ "$tmp1" == "$tmp2" ]] && [[ "$gw" == "$gw1" ]]; then
|
||||
if [ "$tmp1" = "$tmp2" ] && [ "$gw" = "$gw1" ]; then
|
||||
ret=1
|
||||
break
|
||||
fi
|
||||
@@ -74,12 +76,12 @@ route_exists()
|
||||
}
|
||||
|
||||
result=$(route_exists $net $mask $gw)
|
||||
if [[ "$result" == "0" ]]; then
|
||||
if [[ "$op" == "add" ]]; then
|
||||
if [[ $OSTYPE = linux* ]]; then
|
||||
if [ "$result" = "0" ]; then
|
||||
if [ "$op" = "add" ]; then
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
cmd="route add -net $net netmask $mask gw $gw"
|
||||
else
|
||||
$cmd="route add -net $net -netmask $mask $gw"
|
||||
cmd="route add -net $net -netmask $mask $gw"
|
||||
fi
|
||||
echo "$cmd"
|
||||
result=`$cmd 2>&1`
|
||||
@@ -93,11 +95,11 @@ if [[ "$result" == "0" ]]; then
|
||||
echo "The route ($net $mask $gw) does not exist."
|
||||
fi
|
||||
else
|
||||
if [[ "$op" == "delete" ]]; then
|
||||
if [[ $OSTYPE = linux* ]]; then
|
||||
if [ "$op" = "delete" ]; then
|
||||
if [ "$(uname -s)" = "Linux" ]; then
|
||||
cmd="route delete -net $net netmask $mask gw $gw"
|
||||
else
|
||||
$cmd="route delete -net $net -netmask $mask $gw"
|
||||
cmd="route delete -net $net -netmask $mask $gw"
|
||||
fi
|
||||
echo "$cmd"
|
||||
result=`$cmd 2>&1`
|
||||
|
||||
Reference in New Issue
Block a user