Operating System - HP-UX
1830207 Members
1621 Online
109999 Solutions
New Discussion

Running 'Java' UPS-monitor in background ?

 
MARREEL Chris_1
Regular Advisor

Running 'Java' UPS-monitor in background ?

I'm configuring a non HP UPS (Victron). This has a software to monitor the status of the UPS, and this software is a JAVA application.

I can perfectly run this JAVA-software in foreground, but I'm investigating how I can configure and start it so this peace of JAVA-software is running in the background and started if the machine is booted.
This configuration is no problem for me, but when I look at the CPU-usage, the jre (Java Runtime environment) is taking all my CPU-time, and there is none left for other user-processes if I run this in background.
If I run the application in foreground, no problem.

The problem (I think) is the application is actualy polling for keyboard-input, and this takes all the CPU-time when it is running in background.

If I start the software in foreground :
guluep04:/opt/pwrjump # ./runjumpu

PowerJUMP - Java UPS monitor version 1.43 (build 14.9.2000)
(c) IMV, 1999

. User: root
. System: HP-UX
. Version: B.11.00
. Architecture: PA-RISC

Configured UPSes:1
UpsWeb is listening on port: 2161
Internal communication port: 2160

[Type 'stop' to stop PowerJUMP]

I can then type stop+Enter to let this software stop.

But if I run this software like this :
guluep04:/opt/pwrjump # /sbin/init.d/powerjump start
Sending output to nohup.out
guluep04:/opt/pwrjump #

The "start"-module looks like this :
if [ "$POWERJUMP" -eq 1 -a -x /opt/pwrjump/runjumpu ]; then

cd /opt/pwrjump
if [ -f nohup.out ]
then
mv nohup.out OLDnohup.out
touch nohup.out
fi
nohup /opt/pwrjump/runjumpu &
set_return
else
rval=2
fi



I see the following happening on my system :
guluep04:/ # sar -u 5 1000

HP-UX guluep04 B.11.00 U 9000/800 02/27/01

17:16:01 %usr %sys %wio %idle
17:20:26 0 0 2 98
17:20:31 0 0 1 99
17:20:36 0 0 0 100
17:20:41 0 0 0 100
17:20:46 13 3 1 83
17:20:51 54 1 1 44
17:20:56 23 16 1 60
17:21:01 63 37 0 0
17:21:06 58 42 0 0
17:21:11 59 41 0 0
17:21:16 61 39 0 0


How can I start this "runjumpu"-script and make it is not hogging all my CPU ?

Greetings,
Chris MARREEL
1 REPLY 1
MARREEL Chris_1
Regular Advisor

Re: Running 'Java' UPS-monitor in background ?

I have found a solution for this. I have contacted the creators of this software and they came up with an 'undocumented' (but important) feature. You can add the option "-service" and then it runs nice in the background, doing his job, but not listening to some input or writing something to output.

This "-service" sounds a little like NT ? But it works for me.

Kind regards,
Chris MARREEL