Commodore Commodore
Commodore
457 views

migrate agent

Jump to solution

Would it be possible that the migrate agent script is not set to handle AIX properly?

Seems like these lines:

echo "Waiting for agent to start up"
retry 10 "netstat -an | grep ':1002 ' | grep LISTEN >/dev/null 2>&1 && echo done || echo retry" "waiting for port 1002 to open"

 

Won't work, the AIX response is usually:

# netstat -an | grep '1002 '
tcp4 0 0 *.1002 *.* LISTEN

There's no ":", therefore the script waits and timeout unsuccessfully

RHEL works just fine:

[root@prd-vusaapp01 ~](502) # netstat -na |grep 1002
tcp 0 0 0.0.0.0:1002 0.0.0.0:* LISTEN

Thanks

 

Pierre.

1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

The migrator APX is shipped in source code form.  It's part of the support tooling.
Modify the code and then re-impor the APX as per its README.txt instructions.

/opt/opsware/support/APX/com.hp.device.migrator/scripts/unix/migrate.sh

--- com.hp.device.migrator/scripts/unix/migrate.sh (revision 85021)
+++ com.hp.device.migrator/scripts/unix/migrate.sh (working copy)
@@ -99,7 +99,7 @@
agent_service_cmd stop

echo "Waiting for agent to shutdown"
-retry 10 "netstat -an | grep ':1002 ' | grep LISTEN >/dev/null 2>&1 && echo retry || echo don
e" "waiting for port 1002 to close"
+retry 10 "netstat -an | grep '[:\.]1002 ' | grep LISTEN >/dev/null 2>&1 && echo retry || echo
done" "waiting for port 1002 to close"
if [ "$retry_status" = "failed" ]; then
error_exit "Agent did not shutdown in allotted time."
fi
@@ -151,7 +151,7 @@
agent_service_cmd start

echo "Waiting for agent to start up"
-retry 10 "netstat -an | grep ':1002 ' | grep LISTEN >/dev/null 2>&1 && echo done || echo retry" "waiting for port 1002 to open"
+retry 10 "netstat -an | grep '[:\.]1002 ' | grep LISTEN >/dev/null 2>&1 && echo done || echo retry" "waiting for port 1002 to open"
if [ "$retry_status" = "failed" ]; then
echo "Agent did not start in allotted time."
rollback_and_exit

 

View solution in original post

4 Replies
Micro Focus Expert
Micro Focus Expert

Pierre thanks for taking the time to report this issue.

Indeed I can see that AIX won't work given that output.
Once thing to be very careful of with any correction is that you need to make sure that the grep picks the one we want and not the others (for example).

tcp4 0 0 *.1002 *.* LISTEN
tcp4 0 0 *.10021 *.* LISTEN
tcp4 0 0 *.11002 *.* LISTEN

A grep for just 1002 will find things listening all those ports.  If you look carefully you will see there is a trailing space '1002 ' in our grep so that will stop a match on 10021 but it would still match 11002.  The leading : as in ':1002 ' was to stop it matching 11002, which is find for Linux but NOT for AIX (our problem)

If you remove the : that will make AIX work but then you now also subject to matching lines you should not.   We need to modify the code to do this, either a : or . is valid as a proceeding char before the port.

grep ':1002 ' 

Should be coded as:

grep '[:\.]1002 '

You can make that change in the code yourselves and upload a replacement APX.  I'll do the same in our code base.

Thanks again.  Brett

ps: There are TWO places you need to fix this in the code.

0 Likes
Commodore Commodore
Commodore

About: ":You can make that change in the code yourselves and upload a replacement APX",

I looked in the "The Way" (1018) for the script, obviously it's not there but I don't really know how to extract and rebuild a APX, any lead?

 

Thanks

 

Pierre

0 Likes
Micro Focus Expert
Micro Focus Expert

The migrator APX is shipped in source code form.  It's part of the support tooling.
Modify the code and then re-impor the APX as per its README.txt instructions.

/opt/opsware/support/APX/com.hp.device.migrator/scripts/unix/migrate.sh

--- com.hp.device.migrator/scripts/unix/migrate.sh (revision 85021)
+++ com.hp.device.migrator/scripts/unix/migrate.sh (working copy)
@@ -99,7 +99,7 @@
agent_service_cmd stop

echo "Waiting for agent to shutdown"
-retry 10 "netstat -an | grep ':1002 ' | grep LISTEN >/dev/null 2>&1 && echo retry || echo don
e" "waiting for port 1002 to close"
+retry 10 "netstat -an | grep '[:\.]1002 ' | grep LISTEN >/dev/null 2>&1 && echo retry || echo
done" "waiting for port 1002 to close"
if [ "$retry_status" = "failed" ]; then
error_exit "Agent did not shutdown in allotted time."
fi
@@ -151,7 +151,7 @@
agent_service_cmd start

echo "Waiting for agent to start up"
-retry 10 "netstat -an | grep ':1002 ' | grep LISTEN >/dev/null 2>&1 && echo done || echo retry" "waiting for port 1002 to open"
+retry 10 "netstat -an | grep '[:\.]1002 ' | grep LISTEN >/dev/null 2>&1 && echo done || echo retry" "waiting for port 1002 to open"
if [ "$retry_status" = "failed" ]; then
echo "Agent did not start in allotted time."
rollback_and_exit

 

View solution in original post

Commodore Commodore
Commodore

Got it fixed, thanks Brett. All working now.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.