Please Help: How to Call SSH Trust from Cron job.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please Help: How to Call SSH Trust from Cron job.
# 1  
Old 12-13-2008
Please Help: How to Call SSH Trust from Cron job.

Hi All,
I am tring to excute a SSH trust command from a script which is invoked by crontab.

Details:

Crontab file contains the following line:

15 00 * * * /users/dummy_user/dummy_script1.sh

dummy_script1.sh contains the following line:

SSH -1 server_2 "/users/dummy_user/dummy_script2.sh" > /users/dummy_user/output.txt

exit


When I excute
/users/dummy_user/dummy_script1.sh directly it excutes fine.

But when its called from Cron job its not at all excuting the SSH command.

Note: All auth keys are set in both servers.
# 2  
Old 12-13-2008
Hi,
Make sure that the script You run have sufficient environment variables set. You may need to source in any profile file that is used in Your command shell.

/Lakris
# 3  
Old 12-13-2008
Hi Lakris,
Thanks for the reply.
All then envi varialbles are set to 777. And can you please tell me wat kind of profile options needs to be defined for SSH.
Thanks in advance.

Regards
Suman
# 4  
Old 12-14-2008
What I meant was that when You run something from the command line You a fuller set of environment variables, such as PATH. Do this experiment, put these lines in Your script:

env > /tmp/cronenv
. ~/.bashrc
env > /tmp/userenv

... (the rest of the code)

and compare the two. The first one shows the environment used by cron, the second what Your command prompt has available. You may need to include /etc/profile or some other rc-file depending on what shell You use.

Are You really calling ssh with capitals, SSH?

/Lakris
# 5  
Old 12-15-2008
No I am not using upper case ssh.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

2. Shell Programming and Scripting

SSH Trust Testing

Hi, I want test the ssh trust between two host. It works fine if the trust is working fine but if the trust is not working fine it gets stuck. #!/bin/sh >/users/test/ssh.txt for i in `cat /users/test/host.txt`; do ssh test@$i uname -a >> /users/test/ssh.txt test=`cat... (0 Replies)
Discussion started by: Abhayman
0 Replies

3. Shell Programming and Scripting

Commented cron job -- cron monitoring

Hi I have a requirement to write a shell script,that will check the all commented job in cron job.Please help !! (2 Replies)
Discussion started by: netdbaind
2 Replies

4. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

5. UNIX for Dummies Questions & Answers

SSH Cron Job Help

Hi there, I have an ESXi server and I need to shut it down every night (say at 11 for simplicity). To shut down the ESXi box remotely, I can send an SSH command "poweroff". Basically my question is, is there any way that I can save the script on my DD-WRT router so that it will login to the... (3 Replies)
Discussion started by: georgeharris
3 Replies

6. Shell Programming and Scripting

Cron job initiating ssh AND sudo (from user, not root)

I've been bashing my head on the desk for 2 days trying to get this to work, but I've had no luck. I'll try to be as clear as possible in my explanation without dragging out the details. I'm trying to set up a cron job for user "john" which runs a script. This script initiates an ssh connection to... (5 Replies)
Discussion started by: eh3civic
5 Replies

7. UNIX for Dummies Questions & Answers

ssh trust issue

Hi, i am setting up ssh trust setup between two servers where SVRA is a solaris box and SVRB is a Red Hat Linux. It is asking for the password all the time. I have copied over the SVRA:/home/nagios/.ssh/id_dsa.pub as authorized_keys on to SVRB:/dat01/home/nagios/.ssh/ -bash-3.00$ ssh -vvv... (4 Replies)
Discussion started by: uxadmin007
4 Replies

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

9. Solaris

cron job starts new cron proccess

I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Discussion started by: ron76
3 Replies

10. SuSE

ssh-keygen trust problem

OK, this is the problem. I have 2 machines TestA ( Suse 9.0 ) TestB ( Mandrake 10 ) and one of our guys wants to scp from TestA to TestB without the password prompt appearing. Sounds simple so far.... Ok, I haven't used ssh-keygen before, so I create identical logins to test what I'm doing...... (4 Replies)
Discussion started by: PaulC
4 Replies
Login or Register to Ask a Question