Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

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


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 (./ but if i execute this using cron jobs it does every thing othre then scp part of it .

file name is
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@$(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" < cvsbackup.txt

Please help.


Yogendra Rawat
Old 09-15-2005, 02:13 AM   #2
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?

Old 09-15-2005, 02:34 AM   #3
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 ''

copy /root/.ssh/ to the backup server

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


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-28-2008 11:41 PM
cron jobs work fine when invoked from webmin but fail on schedule jillu Linux - Enterprise 3 01-20-2005 01:34 PM
cron jobs working2hard Linux - Software 0 07-28-2004 05:31 PM
CRON Jobs scottpioso Linux - Software 63 11-28-2003 06:45 PM
cron jobs - tar scp in one line? bkeating Linux - Software 1 11-04-2003 03:49 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:07 AM.

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