to write the logs of scp

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting to write the logs of scp
# 1  
Old 10-08-2007
to write the logs of scp

Hi Unix gurus,

I created this script to automate the copying of files daily from one server to another using the scp command.


if [ ! -f $KEY ];then
echo "Private key not found at $KEY" >> $LOGFILE
echo "* Please create it with \"ssh-keygen -t dsa\" *" >> $LOGFILE
echo "Transferring files.." >> $LOGFILE
echo "Copy files successful.." >> $LOGFILE
But I have these questions 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 ' (' 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.
# 2  
Old 10-08-2007

The rules say
(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly.

You have already broken it twice. Once more and you will earn a ban.
Please be patient and adhere to the rules.

Your other thread -
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies

2. Programming

Interactive Python 3.5+ sys.stdout.write() AND sys.stderr.write() bug?

(Apologies for any typos.) OSX 10.12.3 AND Windows 10. This is for the serious Python experts on at least 3.5.x and above... In script format sys.stdout.write() AND sys.stderr.write() seems to work correctly. Have I found a serious bug in the interactive sys.stdout.write() AND... (2 Replies)
Discussion started by: wisecracker
2 Replies

3. Shell Programming and Scripting

Is it possible to write write multiple cronjobs in shellscript??

Hi All, I need the answer of below question? 1) How to write multiple cronjobs in shellscript? Is there any way or we cant write in shellscript... Regards, Priyanka (2 Replies)
Discussion started by: pspriyanka
2 Replies

4. Homework & Coursework Questions

How to write logs to new folder?

Hi the below is my code and my requirement is a. Whenever below scripts run – logs should be redirected to a new log file in /u/file/newlog folder. Please let me know how to write this info #!/bin/ksh choice=$1 browcher=$2 ne=$3 Flow=$4 logFile=~mbadm/redeploy.log case "$choice"... (5 Replies)
Discussion started by: dsreddy447
5 Replies

5. Shell Programming and Scripting

How to write SCP success or failure to a file

Does anyone know how to write the results (success and failure) to a file. I am using TCSH on a Solaris machine. I have the following code for a successful SCP...could someone help me add to this so it caputres failures also? CODE SO FAR (received from a previous post): scp sourcefile.txt... (3 Replies)
Discussion started by: thibodc
3 Replies

6. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

7. Shell Programming and Scripting

How to write logs to a specified Directory??

I have the following script which writes the output of the scirpt in a log file in the same directory from which the script is run. I need the scipt to write the logs daily to a differnt directory with the date appended to the log on a daily basis. The script is as follows... .... (1 Reply)
Discussion started by: nirmal84
1 Replies

8. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

9. Shell Programming and Scripting

Grep yesterday logs from weblogic logs

Hi, I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows: """"""""""""""""""""""""""... (3 Replies)
Discussion started by: harish.parker
3 Replies

10. Linux

scp logs

hi everyone , can any one tell in hp-ux, wheather we get logs for scp and if so where are the generated logs stored?? :confused: (0 Replies)
Discussion started by: gsr_kashyap
0 Replies
Login or Register to Ask a Question