Sponsored Content
Full Discussion: scp automated script
Top Forums UNIX for Advanced & Expert Users scp automated script Post 302208946 by nareshkumar2705 on Wednesday 25th of June 2008 11:14:53 AM
Old 06-25-2008
scp

Hi Unix gurus,

I am trying to create a script to automate the copying of files daily from one server to another using the scp command.
-->
#!/bin/ksh

KEY="$HOME/.ssh/SSHKEY"

if [ ! -f $KEY ];then
echo "Private key not found at $KEY" >> $LOGFILE
echo "* Please create it with \"ssh-keygen -t dsa\" *" >> $LOGFILE
exit
else
echo "Transferring files.." >> $LOGFILE
echo "scp -v -i $KEY $FILES $SCP_LOGIN@$SCP_MACHINE:$SCP_PATH" >> $LOGFILE
scp -v -i $KEY $FILES $SCP_LOGIN@$SCP_MACHINE:$SCP_PATH >> $LOGFILE
echo "Copy files successful.." >> $LOGFILE
fi

My questions are below:
1. Whenever I ran this script, it no longer ask for password but it still prompts the "Are you sure you want to continue connecting (yes/no)?" question:
See details below:
-->
Putting your key on remote server
Transferring files..
The authenticity of host '10.68.169.168 (10.68.169.168)' can't be established.
RSA key fingerprint is cd:78:a1:fe:2d:8d:aa:0f:32:be:18:5b:74:0e:3a:c1.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/shared/home/ngtman/.ssh/known_hosts).

Can I also automate it in a way that it always answers yes to the above question w/o me typing anymore?

2. How can i display the error messages of the scp in the $LOGFILE for cases that scp was not successful for some files?
i.e. there are space issue with the remote server, connection time out, or permission issues. I just want to see in the log what happened to
the scp so as it would also be better for the support guys to check as in case anything happens.

I tried both redirecting using >> and using the tee command but both not writing to the logfile, only displaying the status in the prompt.

Hoping to hear from you guys.

Thanks in advance.


Hi gholdbhurg,

I am also facing the same situation now. Smilie

So, please let me know what solution you used to resolve this problem.

Please send me the details to nareshkumar.gandham@hcl.in

Thanks inadvance for your help.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

help for automated script

Hi ALL: I need to write a script that will start bunch of servers. and these servers each has a sudo account and they need a passowrd. I dont know where to start and look. Can you please give me some hints or some sample code. Thanks in advance. splax (4 Replies)
Discussion started by: splax
4 Replies

2. Shell Programming and Scripting

Need automated shell script please

I'm totally new to shell scripting and I would like to ask your help 1.i want to have a .sh script where it runs opening 2 applications one after another 2.i have 2 applications in /applications/app1 /applications/app2 3. want this script to launch app1 for 20 seconds and get killed... (2 Replies)
Discussion started by: uneex
2 Replies

3. Shell Programming and Scripting

i want automated script

echo "Enter your choice :\c" read num case $num in . 1)"${TEST_HOME}"/ctrl_extract.ksh 1 ;; 2)"${TEST_HOME}"/ctrl_extract.ksh 2 ;;3)"${TEST_HOME}"/ctrl_extract.ksh 3 ;; 4)"${TEST_HOME}"/ctrl_extract.ksh 4 ;; 5)"${TEST_HOME}"/ctrl_extract.ksh 5 ;;... (3 Replies)
Discussion started by: arghya_owen
3 Replies

4. UNIX for Dummies Questions & Answers

Automated backup script

I want to create an automated backup script that will copy files to different directories for different days. I will use a detachable USB drive, under SCO 5.0.7. I am very new to Unix, and will require most of the script. Thanks (5 Replies)
Discussion started by: Bennieinbots
5 Replies

5. UNIX for Advanced & Expert Users

Automated SCP script passing password to preserve source file timestamp

Hi My requirement is i want to copy files from remote server to the local server and also i need to preserve the timestamp of the remote file. By using scp -p , it is working fine in the interactive call but it is not preserving he file timestamp when i use it in the non interactive scp call... (1 Reply)
Discussion started by: skumar75
1 Replies

6. Shell Programming and Scripting

Help with Automated Shell Script

Hello, how can I write a shell script that looks in running processes and if there isn't a process name containing 91.34.124.35 then execute a file in a certain place. I know PHP, in PHP I could do a preg_match_all but I don't know how to do it in shell. (5 Replies)
Discussion started by: nottingham
5 Replies

7. Shell Programming and Scripting

Automated SCP from a job?

Hi all - I have a script which runs on the OS level, but refuses to run as a cron or as an Oracle job. The Script is pretty straight forward: #!/bin/bash username="MyUsername" host="Remote.server" path="Remote.directory/files/*.*" password="MyPassword" expect -c " spawn /usr/bin/scp... (3 Replies)
Discussion started by: danimaltex
3 Replies

8. UNIX for Dummies Questions & Answers

how to make script automated

if i have a script called test.sh file1=$(ls -l|awk '{print $9 $1}') awk ' /date_of_selling:/ { print $6 ":" &9 }' /$file1 >> data.txt if i wanna this script to run automatically every day at 8 am :D (3 Replies)
Discussion started by: teefa
3 Replies

9. Shell Programming and Scripting

Need an automated script

Hi, I need a script to execute below task. As of now I am doing it manually and want it automated. 1)go to below path cd /path/of/file check for the availibility of two file as below of the latest date. test.week1.data test.week2.data Case1. If above files are not present... (3 Replies)
Discussion started by: sv0081493
3 Replies

10. Shell Programming and Scripting

Automated scp using shell & expect

Hi All, I have written a script to automate scp of files. Most of the times it works fine except few cases. I want your help and suggestions to fix these failures. I have used expect & shell to do the automated scp. Below is code $ cat scp.ksh #!/bin/ksh inputfile=$1 fdest_sid=$2... (8 Replies)
Discussion started by: veeresh_15
8 Replies
GNUNET-DHT-PUT(1)					      General Commands Manual						 GNUNET-DHT-PUT(1)

NAME
gnunet-dht-put - Issue a PUT request to the GNUnet DHT insert DATA under KEY. SYNOPSIS
gnunet-dht-put [options] DESCRIPTION
gnunet-dht-get Issue a PUT request to the GNUnet DHT insert DATA under KEY. OPTIONS
-c FILENAME, --config=FILENAME Use the configuration file FILENAME. -d DATA, --data=DATA The data to insert under the key. -e EXPIRATION, --expiration=EXPIRATION How long to store this entry in the dht (in seconds). -h, --help Print short help on options. -k KEY, --key=KEY The query key. -L LOGLEVEL, --loglevel=LOGLEVEL Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR. -l LOGFILE, --logfile=LOGFILE Configure logging to write logs to LOGFILE. -r LEVEL, --replication=LEVEL How many parallel requests (replicas) to create. -T TIMEOUT, --timeout=TIMEOUT How long to execute this query before giving up? -t TYPE, --type=TYPE The type of data to look for. -V, --verbose Be verbose (print progress information). -v, --version Print GNUnet version number. BUGS
Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet-developers@gnu.org> GNUnet Jan 4, 2012 GNUNET-DHT-PUT(1)
All times are GMT -4. The time now is 05:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy