running script in cron - with ssh commands - not working


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting running script in cron - with ssh commands - not working
# 29  
Old 05-17-2005
I'm not sure if this is the issue. It could be. Do you have a server where you can install OpenSSH and test from there?

I saw one post on google where the user added -1 to the ssh command line and it worked. But the downside is youre using protocol 1. Not really a solution.
# 30  
Old 05-18-2005
ah ha!

I have installed openssh on the same server - and change my script to use the full path name of the openssh i installed.

Now it works fine from cron, the scripts execute and the processing exit as expected.

Weird one this - but this fix will do fine for me. Thanks for sticking it out - the help is very much appreciated!
# 31  
Old 09-16-2008
Hi All,
I have a query in calling shell script using SSH.
Eg :
i have established passwordless SSH connection between two servers say user1@ser1 and user2@ser2. I need to call the script in ser2 from ser1.
i can able to execute if run the command individually in prompts i.e
$ssh user2@ser2
$sh scriptname.sh ...
The above works fine but if i give like
ssh -l user2 ser2 "//home//scriptname.sh"
then it shows the error "sqlplus:not found"

Please help me to understand the problem
# 32  
Old 09-16-2008
Quote:
Originally Posted by Preet
Hi All,
I have a query in calling shell script using SSH.
Eg :
i have established passwordless SSH connection between two servers say user1@ser1 and user2@ser2. I need to call the script in ser2 from ser1.
i can able to execute if run the command individually in prompts i.e
$ssh user2@ser2
$sh scriptname.sh ...
The above works fine but if i give like
ssh -l user2 ser2 "//home//scriptname.sh"
then it shows the error "sqlplus:not found"

Please help me to understand the problem
I think you will probably find that the path for sqlplus is not set properly when you run this remotely.
It should work if you specify the full path to sqlplus in your script or else you could set all the environment variables (such as PATH) in your script so that they are set up as if it was the same as you logging in to the server
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Commands not working with ssh remote login

Hi Friends, I am unable to run our application commands on remote server using ssh (passwordless login enabled). But the same command running with telent perl script. please suggest. SSH: C:/bin>ssh -l monitor tl04cp01 exec "/home/monitor/123" /home/monitor/123: viewlog: not found. ... (7 Replies)
Discussion started by: suresh3566
7 Replies

2. Shell Programming and Scripting

Ssh - running commands on remote server

Hi, I am trying to run commands on a list of servers that I can ssh to and just want to know if there is a 'cleaner' way of doing this. At the moment, I am doing as below. Is there a way that I can escape the double quote differently? If a use a single quote to enclose the commands that I... (1 Reply)
Discussion started by: newbie_01
1 Replies

3. Shell Programming and Scripting

Running Commands on a Remote Linux Server over SSH

Hello, I'm trying to create a ksh script to ssh to a remote server, enter the password and a couple commands. For security reasons I have changed the login, password and ip in my example. #!/bin/ksh ssh -t -t username@12.5.5.3 << EOF password cd bin pwd EOF When I run it. It... (5 Replies)
Discussion started by: seekryts15
5 Replies

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

5. Shell Programming and Scripting

How to automatically run commands after SSH and SUDO not working?

I'm working on a script to SSH and SUDO as (sap user sidadm) then automatically run commands that the sidadm user can run such as R3trans -v, tp, etc.. I can SSH without password and SUDO.. but the commands don't run after I SSH and SUDO to the sidadm user...here is the commands that I've... (2 Replies)
Discussion started by: icemanj
2 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

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

8. Shell Programming and Scripting

Running script and commands through SSH

Hello All, I am trying to run some simulations through SSH from my mac on our university SOLARIS system. My problem is that whenever I want to execute a command I get an error which says "Invalid argument". Maybe I should explain more what I want to do and what I did. Firstly I installed a... (10 Replies)
Discussion started by: Apfik
10 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

Cron job giving error while running SSH command

Hi All, The script which i am using to SSH to remote server is working fine when i run is using ./ but when cron runs it it gives error that "ssh: not found" please help!!! (3 Replies)
Discussion started by: visingha
3 Replies
Login or Register to Ask a Question