![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| The "PS" command was displaying*terminals named as "SYSCON" | kiranjose85 | UNIX for Advanced & Expert Users | 1 | 11-28-2008 07:53 AM |
| "find command" to find the files in the current directories but not in the "subdir" | swamymns | Shell Programming and Scripting | 9 | 07-22-2008 12:23 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| usage of "at" command instead of crontab | Love | SUN Solaris | 8 | 06-20-2006 10:19 AM |
| Unix "at" / "Cron" Command New Problem...Need help | Mohanraj | UNIX for Dummies Questions & Answers | 3 | 01-26-2006 08:08 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How to schedule "topas" command in crontab
Hi,
Grateful if you could advise how to schedule the AIX "topas" command in crontab? Below script works fine at shell prompt. But it does not run via crontab at an AIX Server. Script: topas_run.sh export top_file=/oracle/rman_scripts/"topas_run"_`date '+%m_%d_%y_%H_%M_%S'`".txt" echo >> $top_file echo >> $top_file echo "--------------------------------------------------------------------------------" >> $top_file (sleep 3; echo q)|/usr/bin/topas >> $top_file echo >> $top_file echo "--------------------------------------------------------------------------------" >> $top_file Crontab Entry: 0,1 23 * * * /oracle/rman_scripts/topas_run.sh >> /oracle/rman_scripts/topas_run.txt 35 23 * * * /usr/bin/topas > /oracle/rman_scripts/logfile |
|
|||||
|
Check this out (cron and crontab).
Environment invoked by cron is different than when running on shell. The article covers all aspects. |
|
||||
|
I tried out as per the tutorial....I am still not able to get output through cron entry. Grateful if any hints or solution to this problem !!
I edited .profile file at AIX server. Its entry is as below .profile:/ export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1 PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:. export PATH=$PATH:/u01/app/oracle/product/10.2.0/db_1/bin export LD_LIBRARY_PATH=$ORACLE_HOME/lib export TNS_ADMIN=$ORACLE_HOME/network/admin if [ -s "$MAIL" ] # This is at Shell startup. In normal then echo "$MAILMSG" # operation, the Shell checks fi # periodically. stty erase ^? env > /tmp/mycommandline.env . /tmp/mycommandline.env /.profile Pasting the called script again topas_run.sh:/ #!/usr/bin/ksh . ${HOME}/.profile PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/u01/app/oracle/product/10.2.0/bin:/home/oracle/bin:/usr/bin/X11:/sbin:.:/u01/app/oracle/product/10.2.0 /bin ; export PATH export top_file=/oracle/rman_scripts/"topas_run"_`date '+%m_%d_%y_%H_%M_%S'`".txt" echo >> $top_file echo >> $top_file echo "--------------------------------------------------------------------------------" >> $top_file (sleep 3; echo q)|/usr/bin/topas >> $top_file echo >> $top_file echo "--------------------------------------------------------------------------------" >> $top_file /topas_run.sh |
|
||||
|
We assume that this is a root cron.
Suggest you create a one-off cron to run the "env" command once. The output from this "env" command should be in root mail. This will tell you your environment when running under cron. Look at the value of $HOME and $PATH . Note that $TERM is probably not set. The "topas" command is an interractive screen-based command and will need $TERM set. An "stty" command issued from cron will fail. The error output from your failing "topas" crons should be in root mail. Please post your error messages if any. The last line of topas_run.sh is "/topas_run.sh". This line is surplus. |
|
||||
|
Thanks methyl !!
We have tried to schedule "crontab" entry for topas as "oracle" user. It is not root user. I could not get first 5 lines. could you please write distinctly here please, what should I do & test? Also, I am new to this forum....wanted to give bluish tinge to the code..hence kept "/topas_run.sh" at the last line. But it failed.... ))Thank you very much for sharing your knowledge. |
|
||||
|
If you type the unix "env" command it shows you the environment variables in your environment when logged in normally.
If you run the "env" command once from cron it shows you the environment when running under cron (which will be quite different). Also this will show you whether cron is working and whether you can find untrapped output from cron jobs in mail. If the cron is under oracle's name the output should be in user oracle's mailbox. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|