variable has no value if run the script automatically/scheduled


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting variable has no value if run the script automatically/scheduled
# 1  
Old 05-16-2011
variable has no value if run the script automatically/scheduled

Hi All,

I am using ksh as the shell. I have a script that should store variable after executing "onstat" on informix. I can execute it successfully without any issue if run manually, however the value is not showing up when run automatically(scheduled).
Is there anything needed to make the value assigned into PGSIZE?

here is the variable assignment i've done
===============
Code:
PGSIZE=`onstat -b|grep buffer|awk '{print $8}'`
echo "after PAGESIZE "$PGSIZE >> space_out2.log

-------

this is the output when run manually
Code:
=> onstat -b|grep buffer|awk '{print $8}'

4096

all i want to do is to store the output into the PGSIZE variable.

all environment variables needed were setup

Code:
#!/bin/ksh
INFORMIXSERVER
INFORMIXDIR
PATH
ONCONFIG

this is the output if executed via scheduled job.
====
bfore PAGESIZE 4096
after PAGESIZE
=====
<<<<<<<<<<<<<<<<<<<<<<<<< This should have "after PAGESIZE" should have "4096" if executed automatically.

also, just initializing hardcoded
Code:
PGSIZE=4096

, seems to be no problem.
# 2  
Old 05-16-2011
Try running the command PGSIZE=`onstat -b|grep buffer` alone in your script and check the logs if all the data is dumped to the log in PGSIZE. Lets see if it is getting something. If nothing is there then try running PGSIZE=`onstat -b` and check the logs.

regards,
Ahamed

Last edited by ahamed101; 05-16-2011 at 08:34 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scheduled job not running automatically in crontab

i have a job scheduled in crontab. The problem is, it is not running automatically as per the time scheduled. But runs when executed manually. What would be the problem? Help me with this please. (6 Replies)
Discussion started by: Santhosh CJ
6 Replies

2. Shell Programming and Scripting

How to run script automatically every 12 hour once?

Hi ! all, I have once script to remove temporary cache and temporary xml files looks like this, as it is taking more space, I would like to run automatically every 12 hour once, and then I want to receive some log as acknowledgement #!/bin/sh echo "Removing logs and temp files (typically... (4 Replies)
Discussion started by: Akshay Hegde
4 Replies

3. Shell Programming and Scripting

run unix script as scheduled job

Hi, I want my unix script to run as a scheduled job such that the script is invoked once every 15 minutes. Is there any way to achieve this other than running the script as a cron job? (2 Replies)
Discussion started by: vignesh53
2 Replies

4. Shell Programming and Scripting

How to run a script automatically

Hi All, How can i run a script every week automatically. Thanks & regards, Sam (5 Replies)
Discussion started by: sam25
5 Replies

5. Shell Programming and Scripting

Automatically run bash script

Hi! I want to run/execute a bash script automatically everytime when a specific file is created or when its timestamp changes. Is this possible? How? Thank you very much for your answers in advance, Regards, Christoph (1 Reply)
Discussion started by: ckofler
1 Replies

6. Shell Programming and Scripting

how to run shell script automatically

hi , i m trying to run bash scrip automaticially but i dont know how i can do this an anybody tell me how i can autorun shell script when i logon . thanks (9 Replies)
Discussion started by: tahir23
9 Replies

7. UNIX for Dummies Questions & Answers

problem when the script is scheduled to run as cron job

Hello, I have problem in executing a shell script. When the shell script is executed at the shell prompt the script works successfully but when the same script is run as a cron job it fails to execute the files called within the shell script. I have scheduled the job in my crontab file as ... (6 Replies)
Discussion started by: forumthreads
6 Replies

8. UNIX for Dummies Questions & Answers

how to run a Script automatically

How to make a script run automatically using a cron?? i do not know abt cron...... if i have simple.sh file and i need this to run everyday at a particular time what needs to be done thanks in advance (4 Replies)
Discussion started by: hamsa
4 Replies

9. UNIX for Dummies Questions & Answers

How to run a script automatically ?????

Hi All, How to run a script automatically using cronjob everyday from Monday to Friday 9A.M to 5P.M at an interval of ONE HOUR.I want the complete syntax means how to put in the cron job and there after. URGENTLY NEED HELP THANKS IN ADVANCE CHEERS Arunava (7 Replies)
Discussion started by: arunava_maity
7 Replies
Login or Register to Ask a Question