Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 18th, 2002, 10:46 AM
chinook chinook is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: London, England
Posts: 262 chinook User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 58 sec
Reputation Power: 8
Cron Problem

Hello,

I am running a cron job to call a shell script which simply copies a file from another server. I have installed keychain and ssh agent to authorise the server. When I run the shell script from the command line it works fine.

The script is as follows:

#! /bin/sh

#Copy everything from the sites directory on the server
scp user@server.domain.co.uk:/root/to/file /root/to/save

exit

And the entry in my crontab (I've tried as root and my own user) for testing:

38 * * * * /path/to/script

When I look at the process list on minute 38, the cron job appears and the scp command is processed. However I never end up with the file.

Anybody any ideas why?

Thanks

Reply With Quote
  #2  
Old February 19th, 2002, 12:16 PM
M.Hirsch M.Hirsch is offline
Contributing User
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Oct 2000
Location: Back in the real world.
Posts: 5,969 M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level)M.Hirsch User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 22 h 39 m 55 sec
Reputation Power: 184
maybe its a search path problem:

try /usr/sbin/ssh ...

users usually have different search path setup than cron has...

[edit]
/usr/sbin/scp of course
[/edit]

Reply With Quote
  #3  
Old May 12th, 2002, 12:47 AM
pentium5 pentium5 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: entlegen
Posts: 442 pentium5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
that is no right for scp

Quote:
#! /bin/sh
date1=`date`
title=$date1

#Copy everything from the sites directory on the server
scp password=password -r -v -4 -P 22 sally@192.168.1.80:/var/qmail /var/save
#server.domain.co.uk:/root/to/file /root/to/save
date2=`date`
title2=$date2
echo "scp completed" | mail -s "completed backup start at $title ended at $title2"
exit



[root@energy sally]# ./scp-test
Executing: exec cp -r password=password /var/save
cp: cannot stat `password=password': No such file or directory
Executing: program /usr/bin/ssh host 192.168.1.80, user sally, command scp -v -r -d -f /var/qmail
/var/save: No such file or directory
You must specify direct recipients with -s, -c, or -b.
[root@energy sally]# sally@192.168.1.80's password:
Permission denied, please try again.
sally@192.168.1.80's password:
Permission denied, please try again.
sally@192.168.1.80's password:
Permission denied (publickey,password,keyboard-interactive).


not working at all. any ideas are welcome
__________________
regards,

wish to use AT 89c51 single chip computer to do remote sensing and send the data back from woods to office via nokie 3330 and internet. HOW?
first I must revise C program thro' example, what's next?

Reply With Quote
  #4  
Old May 12th, 2002, 07:17 PM
phoenix_rizzen phoenix_rizzen is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Kamloops, BC, Canada
Posts: 55 phoenix_rizzen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Cool

What you want to do is create a new key pair, without a passphrase. Copy the public portion of this keypair to the ~/.ssh/authorized_keys file of the user you will be signing in as. Copy the rivate portion of this keypair to ~/.ssh/ on the client machine.

Then, modify your script to read as follows:
Code:
#! /bin/sh
email="admin@company.com"
date1=`date`

#Copy everything from the sites directory on the server
scp -r -i /path/to/private/key/file sally@192.168.1.80:/var/qmail /var/save
date2=`date`
echo -e "backup start: ${date1}\nbackup ended: ${date2}" | mail -s "SCP complete" ${email}
exit 0


Voila. Test it a few times from the command-line before adding it to cron.
__________________
Linux is for those who hate Windows.
FreeBSD is for those who love UNIX.
-------
Have you read The Handbook yet?
How about The FAQ?
Have you searched the mailing lists?
Or read any of the man pages?
Have you searched the web for BSD resources?
In short, have you done your homework yet?

Reply With Quote
  #5  
Old May 18th, 2002, 11:10 AM
pentium5 pentium5 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: entlegen
Posts: 442 pentium5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
I have left this untouch, sorry about this.

I tried to-morrow and more communication will be needed.

TIA.

Reply With Quote
  #6  
Old May 24th, 2002, 10:50 AM
pentium5 pentium5 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: entlegen
Posts: 442 pentium5 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
I have installed the gnupgp.org , it has too many parmeter to generate the publc key.



scp -r -i /path/to/private/key/file sally@192.168.1.80:/var/qmail /var/save

can u help with this?

Last edited by pentium5 : May 24th, 2002 at 10:54 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > Cron Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway