How to schedule "topas" command in crontab


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to schedule "topas" command in crontab
# 1  
Old 04-22-2009
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  
Old 04-22-2009
Check this out (https://www.unix.com/answers-frequent...n-crontab.html).
Environment invoked by cron is different than when running on shell. The article covers all aspects.
# 3  
Old 04-23-2009
Thank you Zaxxon !!
# 4  
Old 04-23-2009
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  
Old 04-23-2009
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  
Old 04-24-2009
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....Smilie))

Thank you very much for sharing your knowledge.
# 7  
Old 04-24-2009
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

3. Shell Programming and Scripting

Problem with running the "autorep" command via crontab

Hi, The user "MadeInGermany" tried to help on the below post by saying "This has been asked before; see the links below. Get your current LD_LIBRARY_PATH and redefine that in your ksh script! " Thanks for the help. but this did not help. And my post got locked. I can't reply on my previous... (5 Replies)
Discussion started by: girish1428
5 Replies

4. UNIX for Dummies Questions & Answers

Crontab -e command return "413"

I was trying to edit the crontab file for root. I had saved off the existing file for later recovery. When I typed crontab -e to edit, the system returned "413" and the cursor stopped blinking. Ctrl+c stopped that. I typed, in bash, "EDITOR=vi" (Enter). Then, "export EDITOR" (Enter). Then,... (2 Replies)
Discussion started by: roadmanjim
2 Replies

5. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

8. UNIX for Advanced & Expert Users

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

9. UNIX for Dummies Questions & Answers

Command Character size limit in the "sh" and "bourne" shell

Hi!!.. I would like to know what is maximum character size for a command in the "sh" or "bourne" shell? Thanks in advance.. Roshan. (1 Reply)
Discussion started by: Roshan1286
1 Replies

10. Solaris

usage of "at" command instead of crontab

usage of "at" command instead of crontab Hi all, Iam facing some problem while scheduling a script job from crontab. this script is calling one sql script to extract some report information. If I mannually run this script this is working fine. But it is not working with crontab. It is failing... (8 Replies)
Discussion started by: Love
8 Replies
Login or Register to Ask a Question