[
https://issues.apache.org/jira/browse/KARAF-5765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16488433#comment-16488433
]
ASF GitHub Bot commented on KARAF-5765:
---------------------------------------
jbonofre closed pull request #513: [KARAF-5765] Enhance karaf-service on HP-UX
URL: https://github.com/apache/karaf/pull/513
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/wrapper/src/main/java/org/apache/karaf/wrapper/commands/Install.java
b/wrapper/src/main/java/org/apache/karaf/wrapper/commands/Install.java
index 78ca918a9a..3870bd41b2 100644
--- a/wrapper/src/main/java/org/apache/karaf/wrapper/commands/Install.java
+++ b/wrapper/src/main/java/org/apache/karaf/wrapper/commands/Install.java
@@ -249,6 +249,42 @@ public Object execute() throws Exception {
System.out.println(" $ rm /etc/rc1.d/K20" +
serviceFile.getName());
System.out.println(" $ rm /etc/rc2.d/K20" +
serviceFile.getName());
System.out.println(" $ rm /etc/rc3.d/K20" +
serviceFile.getName());
+ } else if (os.startsWith("HP-UX")) {
+ System.out.println("");
+ System.out.println(INTENSITY_BOLD + "HP-UX system detected :" +
INTENSITY_NORMAL);
+ System.out.println(" To install the service (and enable at system
boot):");
+ System.out.println(" $ cp /sbin/init.d/template /sbin/init.d/"
+ serviceFile.getName());
+ System.out.println(" $ cat /sbin/init.d/" +
serviceFile.getName() +" | sed 's/<specific>/" + serviceFile.getName() + "/g' |
\\ ");
+ System.out.println(" awk '/# Execute the commands
to/{print;print \" set_return\";next}1' | \\ ");
+ System.out.println(" sed
's/CONTROL_VARIABLE/CONTROL_VARIABLE_KARAF/g' | \\ ");
+ System.out.println(" sed 's@# Execute the commands to start
your subsystem@ " + serviceFile.getPath() + " start@g' | \\ ");
+ System.out.println(" sed 's@# Execute the commands to stop
your subsystem@ " + serviceFile.getPath() + " stop@g' | \\ ");
+ System.out.println(" sed 's/^[ \t]*.://g' > /sbin/init.d/" +
serviceFile.getName() +".tmp");
+ System.out.println(" $ mv /sbin/init.d/" +
serviceFile.getName() +".tmp /sbin/init.d/" + serviceFile.getName());
+ System.out.println(" $ chmod +x /sbin/init.d/" +
serviceFile.getName());
+ System.out.println(" $ rm -f /sbin/init.d/" +
serviceFile.getName() +".tmp");
+ System.out.println(" $ echo CONTROL_VARIABLE_KARAF=1 >
/etc/rc.config.d/" + serviceFile.getName());
+ System.out.println("");
+ System.out.println(" To start the service when the machine is
rebooted for multi-user run level");
+ System.out.println(" and stopped for the halt, single-user and
reboot runlevels:");
+ System.out.println(" $ ln -s /sbin/init.d/" +
serviceFile.getName() + " /sbin/rc2.d/K20" + serviceFile.getName());
+ System.out.println(" $ ln -s /sbin/init.d/" +
serviceFile.getName() + " /sbin/rc3.d/S20" + serviceFile.getName());
+ System.out.println("");
+ System.out.println(" If your application makes use of other
services, then you will need to make");
+ System.out.println(" sure that your application is started
after, and then shutdown before. This");
+ System.out.println(" is done by controlling the
startup/shutdown order by setting the right order");
+ System.out.println(" value, which in this example it set to
20.");
+ System.out.println("");
+ System.out.println(" To start the service:");
+ System.out.println(" $ /sbin/init.d/" + serviceFile.getName() +
" start");
+ System.out.println("");
+ System.out.println(" To stop the service:");
+ System.out.println(" $ /sbin/init.d/" + serviceFile.getName() +
" stop");
+ System.out.println("");
+ System.out.println(" To uninstall the service :");
+ System.out.println(" $ rm /sbin/init.d/" +
serviceFile.getName());
+ System.out.println(" $ rm /sbin/rc2.d/K20" +
serviceFile.getName());
+ System.out.println(" $ rm /sbin/rc3.d/S20" +
serviceFile.getName());
}
return null;
diff --git
a/wrapper/src/main/resources/org/apache/karaf/wrapper/internal/unix/karaf-service
b/wrapper/src/main/resources/org/apache/karaf/wrapper/internal/unix/karaf-service
index 9597ff66ba..7defa82d1b 100644
---
a/wrapper/src/main/resources/org/apache/karaf/wrapper/internal/unix/karaf-service
+++
b/wrapper/src/main/resources/org/apache/karaf/wrapper/internal/unix/karaf-service
@@ -170,10 +170,14 @@ case "$DIST_OS" in
esac
# Resolve the architecture
-DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
-if [ "$DIST_ARCH" = "unknown" ]
-then
- DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
+uname -p >/dev/null 2>&1
+if [ "$?" -eq "0" ]; then
+ DIST_ARCH=`uname -p | tr [:upper:] [:lower:] | tr -d [:blank:]`
+else
+ uname -m >/dev/null 2>&1
+ if [ "$?" -eq "0" ]; then
+ DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
+ fi
fi
case "$DIST_ARCH" in
'amd64' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
@@ -366,6 +370,9 @@ getpid() {
elif [ "$DIST_OS" = "aix" ]
then
pidtest=`$PSEXE -p $pid -o args | grep "$WRAPPER_CMD" |
tail -1`
+ elif [ "$DIST_OS" = "hpux" ]
+ then
+ pidtest=`UNIX95= $PSEXE -p $pid -o args | grep
"$WRAPPER_CMD" | tail -1`
else
pidtest=`$PSEXE -p $pid -o command | grep $WRAPPER_CMD |
tail -1`
fi
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> karaf-service script not working on HP-UX
> -----------------------------------------
>
> Key: KARAF-5765
> URL: https://issues.apache.org/jira/browse/KARAF-5765
> Project: Karaf
> Issue Type: Bug
> Components: karaf-os-integration
> Affects Versions: 4.2.0
> Environment: HP-UX
> Reporter: Baptiste DA ROIT
> Assignee: Jean-Baptiste Onofré
> Priority: Major
> Fix For: 4.2.1
>
>
> (x) The karaf-service script generated by the _*wrapper:install*_ command is
> not working on HP-UX 11.31, due to:
> # Bad usage of ps command (such as described in KARAF-5753)
> # Bad usage of uname command. The ip option [is not supported on
> HP-UX|https://docstore.mik.ua/manuals/hp-ux/en/B2355-60130/uname.1.html],
> which cause the following error:
> {code:java}
> uname: illegal option -- p
> usage: uname [-amnrsvil] [-S nodename]
> {code}
>
> (on) Point 1 can be resolved using the UNIX95 construct that invokes the XPG4
> environment, which offers some additional options (as explained
> [here|https://community.hpe.com/t5/System-Administration/What-is-UNIX95-in-these-commands/td-p/4968255]).
> (on) Point 2 needs adaptation to the karaf-service script to use uname with
> -p option only if available and to use uname -m instead if -p option is not
> supported.
>
> (!) Moreover, the _*wrapper:install*_ command does not detect HP-UX platform
> an thus does not provide information about how to install an HP-UX standard
> compliant service, as described
> [here|https://community.hpe.com/t5/System-Administration/Proper-Way-of-Adding-rc-Startup-Scripts-on-HPUX/m-p/3206236#M167576].
> (i) Further explanations can be found on the HP community forum:
> *
> [https://community.hpe.com/t5/System-Administration/Adding-script-in-startup/td-p/5322749]
> *
> [https://community.hpe.com/t5/System-Administration/Starting-and-Stopping-a-Program-with-a-Startup-Shutdown-Script/td-p/2943349]
>
>
> {color:#000000} {color}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)