LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-15-2005, 02:56 AM   #1
yogendrarawat
LQ Newbie
 
Registered: Sep 2005
Posts: 1

Rep: Reputation: 0
scp does not work with cron jobs


Hi,


I have written a shall script which creates a tar file and scp to remote machine. It is working fine if i run this script manualy (./backup_agent.sh) but if i execute this using cron jobs it does every thing othre then scp part of it .


file name is backup_agent.sh
----------------------------------------
#!/bin/sh
cd /var/BACKUP
tar -cvf cvsroot.tar /var/cvsroot
#tar -cvf cvsroot.tar cvsbackup.txt
gzip cvsroot.tar
/usr/bin/scp cvsroot.tar.gz root@192.168.1.100:/BEGANTO_BACKUP/cvs/cvsroot-$(date +%Y%m%d-%H%M%S).tar.gz
echo "Backup of cvsroot has been copied in form of .tar.gz file"
mv cvsroot.tar.gz cvsroot-$(date +%Y%m%d-%H%M%S).tar.gz
mail -s "CVS server backup" yogendra.rawat@beganto.com < cvsbackup.txt


Please help.

Thanks

Yogendra Rawat
 
Old 09-15-2005, 03:13 AM   #2
blindcoder
ROCK Linux
 
Registered: Dec 2003
Location: Berlin, Germany
Distribution: Crystal ROCK
Posts: 108

Rep: Reputation: 15
do you have to enter a password to connect to the other machine? which user runs the cronjob? which user runs the script manually?


Greetings,
Benjamin
 
Old 09-15-2005, 03:34 AM   #3
tuXfree
LQ Newbie
 
Registered: Aug 2005
Location: Manila, Philippines
Distribution: Mandrake 10.1 (Official )
Posts: 8

Rep: Reputation: 0
This will allow your server not to authenticate in the backup server:

Do this in the machine that has your cronjob

mkdir p /root/.ssh
chmod 0700 /root/.ssh
ssh-keygen t dsa f /root/.ssh/id_dsa P ''

then
copy /root/.ssh/id_dsa.pub to the backup server

then do this in your backup server
cat id_dsa.pub >> /root/.ssh/authorized_keys2
chmod 0600 /root/.ssh/ authorized_keys2
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-29-2008 12:41 AM
cron jobs work fine when invoked from webmin but fail on schedule jillu Linux - Enterprise 3 01-20-2005 02:34 PM
cron jobs working2hard Linux - Software 0 07-28-2004 06:31 PM
CRON Jobs scottpioso Linux - Software 63 11-28-2003 07:45 PM
cron jobs - tar scp in one line? bkeating Linux - Software 1 11-04-2003 04:49 PM


All times are GMT -5. The time now is 10:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration