

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Got it fixed, thanks Brett. All working now.