Getting issue while running it from cron while manually working fine


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Getting issue while running it from cron while manually working fine
# 1  
Old 01-23-2012
Getting issue while running it from cron while manually working fine

Hello,

I am working one one script where I am using the below code which is using to connect with MKS client when I run my script manually it works effiecently i.e. it connects with MKS client but when I run it from CRON it doesn't connect.

1)Can some one tell when it is running from cron how could I check whether the variables are getting popuated or not
2)Is there any methodwith wich I can achieve this I need to trun this script from cron.


Code:
MKS_Connection()
{
si connect --hostname=si.pan.com --port=7001 --user=Lintomation --password=Lin4tw --yes
ReturnCode=$?;
if [[ "${ReturnCode}" -ne "0" ]];then
echo "Issue found during connection" | mail -s "MKS Connection issue1 from STP" rohit.sin@tlport.com
exit 1;
else
echo "Connection to MKS Client is in progress" |mail -s "MKS Connection1 FROM STP" rohit.sin@tlport.com
fi
}
MKS_Connection

Thanks in advance
# 2  
Old 01-23-2012
Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

2. Shell Programming and Scripting

Crontab - entry not working , cron job not running

I have put a cron entry in oracle user for taking hot backup every wednesday@ 2.30 AM and have given the cron entry 30 02 * * 3 /u01/vijay/hotbackupcron 2>&1 >> /u01/vijay/hotbackup.log also find below the script inside hotbackupcron, i have put in env variables as well ... (13 Replies)
Discussion started by: vijaymec50
13 Replies

3. Shell Programming and Scripting

Issue Running UNIX process from CRON !!

Experts, Not sure whether the problem described here is related with Unix or is it with Oracle Installation. Here is the description of the issue: A new Unix server is setup as a part of Unix and Oracle upgradation activity for one of the Application, I work on. One strange thing is... (2 Replies)
Discussion started by: Oracle_User
2 Replies

4. Shell Programming and Scripting

Part of the Shell script is not running via crontab, runs fine manually

Hello Team, As a part of my job we have made a script to automate a service to restart frequently. Script having two functions when executing it's should find the existing service and kill it, then start the same service . Verified the script it's working fine when executing... (18 Replies)
Discussion started by: gowthamakanthan
18 Replies

5. Shell Programming and Scripting

Shell script not getting called through cron job but executes fine manually.

Hi, My shell script not getting called through cron job. The same works fine when executed manually. I tried to generate logs to find if the scripts has some errors related to path using following command- trying to execute .sh file every 5 mins: */5 * * * * /home/myfolder/abc.sh... (17 Replies)
Discussion started by: Dejavu20
17 Replies

6. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

7. Shell Programming and Scripting

Script runs fine manually but not in crontab

Hello Guys, I have scratched my head alot on this but couldn't find clue what's wrong. Can you please help me with this? My problem is as following. 1) When I manually execute following script it runs successfully with below output. bash-3.00# more smssend #!/bin/bash echo -e "<Request... (16 Replies)
Discussion started by: umarsatti
16 Replies

8. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

9. Shell Programming and Scripting

Running php from cron - working up to a point

Hi there, I am struggling to try and work out what is going wrong with a cron job i have running daily which opens up an imap mailbox and extracts a rar file to a directory on the web server. The script works ok when run manually, and when it is running from cron, I can see that it opens up the... (2 Replies)
Discussion started by: nicky77
2 Replies

10. Shell Programming and Scripting

running script in cron - with ssh commands - not working

I ran an ssh command to run a script on a remote server ssh -l <user> <servername> /path/to/script/scriptname This works fine - and the script is executed correctly. However - I put this command into a script, that I want to run from cron every hour, to execute the file on the remote... (31 Replies)
Discussion started by: frustrated1
31 Replies
Login or Register to Ask a Question