Operating System - HP-UX
1851092 Members
2443 Online
104056 Solutions
New Discussion

Re: How to get output from glance executed by cgi script

 
Jerry Weiss
Occasional Contributor

How to get output from glance executed by cgi script

I have glance on an 11i system. We have apache configured to allow for sysadmins to monitor the system.

My cgi script executes:
export HOME=/tmp
/opt/perf/bin/glance -iterations 2 -all_trans -adviser_only -f /tmp/glance.out 2>/dev/null; cat /tmp/glance.o
ut

Note: its being executed as user www.

I'd like to get the output from glance (as excuted from a cgi script) but I always get the message :

WARNING: Unable to open ".glancerc_hp", "adviser.out", and "glance.err".
Either your $HOME environment is not defined or there is no write
access to your $HOME directory. GlancePlus cannot save data to
customize configuration, or to adviser output or to an error log.
To correct this problem set $HOME to a directory with write
permission and re-start GlancePlus.
If you don't make this change GlancePlus will continue without
these functions.




Does anyone have a suggestion how to fix this?

Thank you in advance,
7 REPLIES 7
Steven E. Protter
Exalted Contributor

Re: How to get output from glance executed by cgi script

ps -ef | grep glance

watch for the PID

kill

or if its sticky

kill -9

This might nail other processes owned by www.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
John Poff
Honored Contributor

Re: How to get output from glance executed by cgi script

Hi,

It looks like Glance is complaining because your 'www' user does not have a valid $HOME directory. Can your 'www' user write to /tmp?

JP
Sridhar Bhaskarla
Honored Contributor

Re: How to get output from glance executed by cgi script

Hi Jerry,

Can you run this script manually and see if it prints anything?

Why are you setting $HOME to /tmp?.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Jerry Weiss
Occasional Contributor

Re: How to get output from glance executed by cgi script

Sri, John,

I did the export HOME=/tmp to insure that www had write permission to create the files.glancerc_hp, adviser.out and glance.err.

I did an su - www (from root) and ran the command and it behaves the same (I had done this prior to posting to the forum), the user www had no problem manually touching, deleting, etc. the files /tmp/.glancerc_hp, /tmp/adviser.out and /tmp/glance.err

I also modified www's default directory (in /etc/passwd) just to make damn sure and I still have the same problem.

However the WARNING from glance still appears! and it still waits for a Return key to continue.

Pete Randall
Outstanding Contributor

Re: How to get output from glance executed by cgi script

Why not just creat a "real" home directory for user www?


Pete

Pete
Ross Zubritski
Trusted Contributor

Re: How to get output from glance executed by cgi script

Jerry,

I was able to duplicate and fix your issue.

1. Create /home/www with appropriate permissions

2. create glance-cgi in your cgi-bin:

#!/bin/sh
set -x
print 'Content-type: text/html\n\n';
export HOME=/home/www
/opt/perf/bin/glance -iterations 2 -all_trans -bootup -adviser_only -f /tmp/glan
ce.out;cat /tmp/glance.out

3. Make sure it is executable.

4. http://yourhost/cgi-bin/glance-cgi

Viola.

Regards,

RZ
Jerry Weiss
Occasional Contributor

Re: How to get output from glance executed by cgi script

Ross,

I'm getting a bit closer but still no luck. By creating the user, with a complete user profile and home directory I can run the command as www in a terminal window, however when I run it in other than a terminal window (e.g. cron or via a cgi script) I do not get any output! The file /tmp/glance.out is 0 bytes!

Is there something I can set to get glance to think a terminal is executing it?