Operating System - HP-UX
1856492 Members
15116 Online
104113 Solutions
New Discussion

Re: glance fails from a script, ok from command line

 
SOLVED
Go to solution
Mladen Despic
Honored Contributor

glance fails from a script, ok from command line

I can run the following from the command line just fine:

glance -adviser_only -syntax adviser.syntax -j60 > glance.out 2>glance.err &

The process continues to run in the background until a 'kill' is executed. But if I do:

sh

the background glance process terminates immediately, while the following gets logged to glance.err:

sh: glance: Execute permission denied.

Can you help me figure out the cause of the problem?

My userid is 0 (root), default shell: /usr/bin/sh . The output of 'll /opt/perf/bin/glance' is:

-r-sr-xr-x 1 root bin 614400 Oct 6 2000 /opt/perf/bin/glance
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: glance fails from a script, ok from command line

Hi:

The problem has nothing to do with 'glance' but rather the way in which you use 'sh' to invoke it.

Consider:

# date #...works, obviously
# sh date # ...gives Execute permission denied.
# sh -c date #...works

The '-c' option means read commands from the string which follows. Thus, in you case:

# sh -c "glance -adviser_only -syntax adviser.syntax -j60 >glance.out 2>glance.err &"

...will provide that which you seek.

Regards!

...JRF...
Vincenzo Restuccia
Honored Contributor

Re: glance fails from a script, ok from command line

Try with chmod 777 /opt/perf/bin/glance and if it's ok return -r-sr-xr-x.
Mladen Despic
Honored Contributor

Re: glance fails from a script, ok from command line

Thank you ...
Dave Jadischke
Occasional Advisor

Re: glance fails from a script, ok from command line

I am trying to run a glance adviser script via cron. From the command line it works great. But from cron seems to just pass over the line. Here is my command:

sh -c "glance -adviser_only -syntax $DIR/gpm -iterations 3 -j 30 >> $DIR/glance.
out &"

I get the output file glance.out but it's empty. I have put a date command before and after the command, and within 1 second both dates return.

Any ideas?



Mladen Despic
Honored Contributor

Re: glance fails from a script, ok from command line

Dave,

I think you need to use the full path:

sh -c "/opt/perf/bin/glance -adviser_only -syntax $DIR/gpm -iterations 3 -j 30 >> $DIR/glance.out &

Mladen