The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-22-2009
schandrakar1 schandrakar1 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 11
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
  #2 (permalink)  
Old 04-22-2009
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,311
Check this out (cron and crontab).
Environment invoked by cron is different than when running on shell. The article covers all aspects.
  #3 (permalink)  
Old 04-23-2009
schandrakar1 schandrakar1 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 11
Thank you Zaxxon !!
  #4 (permalink)  
Old 04-23-2009
schandrakar1 schandrakar1 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 11
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
  #5 (permalink)  
Old 04-23-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,184
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.
  #6 (permalink)  
Old 04-24-2009
schandrakar1 schandrakar1 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 11
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.
  #7 (permalink)  
Old 04-24-2009
methyl methyl is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 1,184
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0