Problem with running the "autorep" command via crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with running the "autorep" command via crontab
# 1  
Old 05-16-2013
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 post.
So, the following is the issue :
I have written a ksh script and I'ma using the following command in it:


Code:
autorep -j %abcd% | grep RU | grep BOX1

The script works fine when executed manualy on the command prompt. But does not work when scheduled in crontab. I could see the following in the crontab log:


Code:
/AutosysScript.ksh[12]: autorep: cannot execute

I then used the whole path of autorep which was /opt/CA/UnicenterAutoSysJM/autosys/bin/autorep instead of just autorep. And then I got the following error in the crontab log after running the script:


Code:
ld.so.1: autorep: fatal: libascmn.so: open failed: No such file or directory
/AutosysScript.ksh[13]: 16123 Killed

Can someone please advice how can I run the autorep command within a ksh script from crontab.


As adviced by the user "MadeInGermany", I added the following line in the beginning of my script, but no use Smilie

Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/CA/UnicenterAutoSysJM/autosys/bin:/opt/CA/UnicenterAutoSysJM/autosys

Can some one please help !

Many thanks !
# 2  
Old 05-16-2013
Try . /etc/profile at the top of the script, to load the usual profile you'd get on your system.
# 3  
Old 05-16-2013
Thanks Corona,

I tried the following at the top of the script but they didn't resolve the issue:

Code:
. /etc/profile


Code:
 
LD_LIBRARY_PATH=`extendpath $LD_LIBRARY_PATH /opt/CA/UnicenterAutoSysJM/autosys/bin`
 
export LD_LIBRARY_PATH



Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/CA/UnicenterAutoSysJM/autosys/bin:/opt/CA/UnicenterAutoSysJM/autosys


Error in Crontab log:

Code:
 
ld.so.1: autorep: fatal: libascmn.so: open failed: No such file or directory
/home/clasp1/utilsGSD/Girish/AutosysRefreshCheck.ksh[32]: 27142 Killed


Is the problem due to 2 copies of the same file in 2 different locations in the library as follows:



Code:
$ cd /opt/CA/UnicenterAutoSysJM/autosys
$ find ./ -name libascmn.so
./lib_bak_Jul_04_08:44/libascmn.so
./lib/libascmn.so
$

Thanks
# 4  
Old 05-16-2013
Have you looked at what's in your ~/.profile yet?
# 5  
Old 05-16-2013
Doing 'man crontab' yields:
Code:
       Only the first line (up to a `%' or end of line) of the	command  field        is executed by the shell. Other lines are made available to the command        as standard input. Any blank line or line beginning with  a  `#'  is  a        comment and is ignored.

If you're using the 'autorep' as quoted above in cron by itself (not as part of a wrapper script), you'll need to escape the embedded '%':
Code:
autorep -j \%abcd\% | grep RU | grep BOX1

If you're using a wrapper script, check your environmental settings and check this FAQ
This User Gave Thanks to vgersh99 For This Post:
# 6  
Old 05-16-2013
Thanks Corona / Vgresh,

But before seeing your post, I converted the script to CSH and it runs fine in crontab.

Thanks very much.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. UNIX for Advanced & Expert Users

"No such file or directory" while running crontab

I am trying to take backup of server. while running manually, script working successfully. while running in crontab its showing "/bin/sh: /webMethod6/CustomMonitoring/scripts/backupWebMethodsCodeBase.sh: No such file or directory" code forbackupWebMethodsCodeBase.sh #!/bin/ksh #Purpose... (8 Replies)
Discussion started by: elango963
8 Replies

3. Shell Programming and Scripting

Problem with "find" and "grep" command

I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank). In a first approach I coded: find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt But this doesn't work. I got an error (under Ubuntu): grep:... (5 Replies)
Discussion started by: pstein
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. Shell Programming and Scripting

Crontab not running "nail" in script

the script is in Perl... this is one part of it: $command = "echo \"$text\" | /usr/bin/nail -s \"My $text1\" $ccstr$addstr"; system("$command") if length($bodytext)>1; crontab runs the script and sends me notifications but i cant receive any mail that i wanted! I'm using the complete path... (1 Reply)
Discussion started by: yeean
1 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. UNIX for Advanced & Expert Users

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 >>... (7 Replies)
Discussion started by: schandrakar1
7 Replies

8. HP-UX

script running with "ksh" dumping core but not with "sh"

Hi, I have small script written in korn shell. When it is called from different script, its dumping core, but no core dump when we run it standalone. And its not dumping core if we run the script using "/bin/sh" instead of "ksh" Can some body please help me how to resolve this issue. ... (9 Replies)
Discussion started by: simhe02
9 Replies

9. UNIX for Advanced & Expert Users

Running command "md5" on remote host not working.

My question is very strange. I can run ls command on remote host using ssh successfully. but when i try to run /sbin/md5 command on remote host. it doesnt run and get back to me on command prompt. md5 command is exist on remote host. This is what i tried which ran successfully. Query -... (1 Reply)
Discussion started by: ynilesh
1 Replies

10. UNIX for Dummies Questions & Answers

Unix "at" / "Cron" Command New Problem...Need help

Hi All, I am trying to schedule a one time job using the at command with the help of shell script for my project. The shell script should take a parameter as a command line argument from the at command itself. Is it possible to take a command line parameter for a shell script in the command... (3 Replies)
Discussion started by: Mohanraj
3 Replies
Login or Register to Ask a Question