1827807 Members
2622 Online
109969 Solutions
New Discussion

Glance file is empty.

 
SOLVED
Go to solution
Eduard Pinales
Advisor

Glance file is empty.

Hi.

I have is scripts run in crontab.

########################################
#!/usr/bin/ksh
fecha=`date | awk '{print $1$2$3$4}`
/opt/perf/bin/glance -f /adm/scripts/glancemonitor$fecha.txt -iterations 1

But the file that generate this scripts is empty. i need help.

Regards,
13 REPLIES 13
Steven E. Protter
Exalted Contributor
Solution

Re: Glance file is empty.

Shalom,

Probably:
No variables are being submitted.
date or awk command are failing because cron jobs have no PATH set.

Set a PATH in your script.

See whence to find PATH

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
Eduard Pinales
Advisor

Re: Glance file is empty.

thanks,

But the problem is that file is empty when scripts is finished by cron. all variable are ok, because the file have the date when script finished.
OFC_EDM
Respected Contributor

Re: Glance file is empty.

I've learned to listen to Steven :)

When you cron a job you dont have an environment.

So when the script executes via cron it will not know where date and awk are located. Thus, the commands will fail.

Try setting a path or explicity call the commands as below

#!/usr/bin/ksh
fecha=`/sbin/date | /usr/bin/awk '{print $1$2$3$4}`
/opt/perf/bin/glance -f /adm/scripts/glancemonitor$fecha.txt -iterations 1

Note the path to the date and awk commands may differ on your system as these paths are from my Tru64 system.

if you don't know the path to the command type:
which date
which awk

It will display where it finds the command...as long as it's in the PATH of the user you're logged in as.

Otherwise use the find command to find where they are.

Cheers
The Devil is in the detail.
Eduard Pinales
Advisor

Re: Glance file is empty.

I did. but the problem not solve.

-rw-r--r--1 root sys 0 Oct 23 11:20 glancemonitorThuOct2311:20:00.txt

The script look as follow .
fecha=`/usr/bin/date | /usr/bin/awk '{print $1$2$3$4}`
/opt/perf/bin/glance -f /adm/scripts/glancemonitor$fecha.txt -iterations 1

Regards
Torsten.
Acclaimed Contributor

Re: Glance file is empty.

I think the problem is somewhere else.

Re-direct the error channel to a file!

I assume something like this:

# export TERM=xx
# glance -f /tmp/t1 -iterations 1

Welcome to Glance


Sorry, I don't know anything about your "xx" terminal.





IMHO your result will be similar!

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Torsten.
Acclaimed Contributor

Re: Glance file is empty.

See

man glance

on how to run it in background.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Torsten.
Acclaimed Contributor

Re: Glance file is empty.

Well, it's the output channel, not the error channel.

# glance -f /tmp/t1 -iterations 1 >/tmp/t2
# more /tmp/t2
Sorry, I don't know anything about your "xx" terminal.

Welcome to Glance


You will probably find related massages in

# more /var/adm/cronlog

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Eduard Pinales
Advisor

Re: Glance file is empty.

the problem is same. The file is empty when the cron run the script.
Torsten.
Acclaimed Contributor

Re: Glance file is empty.

I'm not sure if you understand - a cronjob has no terminal


-> glance will not run!

See

man glance

on how to run glance without a terminal (in background).

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Eduard Pinales
Advisor

Re: Glance file is empty.

Glance not run in Background, but exist any flag to help it run in background for example -adviser_only , etc. i put it, but the problem is the same.

Regards,
Torsten.
Acclaimed Contributor

Re: Glance file is empty.

Does

# man glance

not work on your system???

I copy a part of this for you:

" To run GlancePlus in the background against special adviser syntax,
logging data to a file, you must first create a file that contains the
appropriate adviser commands, then execute GlancePlus with stdout
redirected to a file. For example:
echo 'print gbl_stattime, " runq=", gbl_run_queue' >temp
glance -aos ./temp -j 60>outfile &
"

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Eduard Pinales
Advisor

Re: Glance file is empty.

Ok thanks,

But i need the specific PID. how do i do that ?. not total all. i need to view the utility for every PID.
OFC_EDM
Respected Contributor

Re: Glance file is empty.

I'm curious about whether you get any output from

/opt/perf/bin/glance -iterations 1

Not sure if that's a valid command as I don't have glance available. Basically I want to know if you get output if you don't specify an output file.

My thought is there's no sense trying to redirect to a file if the base command doesn't provide output. Could you confirm that you do get output with the basic command?

Cheers
The Devil is in the detail.