|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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] ![]() |
|
#3
|
|||
|
|||
|
that is no right for scp
Quote:
[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? |
|
#4
|
|||
|
|||
|
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?
|
|
#5
|
|||
|
|||
|
I have left this untouch, sorry about this.
I tried to-morrow and more communication will be needed. TIA. |
|
#6
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Linux Help > Cron Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|