I want to transfer files from ABC server to XYZ server in which i am successful. I would like to create a log file also by the name of current date. For some reason my script gives me an error on my scp -p command and it says LOCAL_LOG_FILE: not found and REMOTE_LOG_FILE not found. Any clues whats going on?
I want to create a log file on the remote system + local system with the "file copied successfully" message included in that log file. But its not creating a log file. Everytime i run the script i get:
LOCAL_LOG_FILE ="log_`date +%m%d%Y`"
category_captains.sh[32]: LOCAL_LOG_FILE: not found.
REMOTE_LOG_FILE ="XYZ:/terry/dukes/bkup/${LOCAL_LOG_FILE}"
category_captains.sh[33]: REMOTE_LOG_FILE: not found.
Because of that i believe its not creating the file
You may have more code than what you posted that is blowing away the file. I am thinking this is so since the code you posted, you are overwritting what you wanted in there:
LOCAL_LOG_FILE ="log_`date +%m%d%y`"
REMOTE_LOG_FILE ="XYZ:/terry/dukes/bkup/${LOCAL_LOG_FILE}"
# Next line creates new file due to > character
date +"%m/%d/%y %H:%M:%S" > $LOCAL_LOG_FILE
scp -p /some/user/files/*.gif
XYZ:/terry/dukes/bkup >$LOCAL_LOG_FILE 2>&1
# This line overwrites what you put in the file already due to > character # you want to append so use >>
echo "File copied Successfully `date +%m%d%y:%H:%M:%S`" >$LOCAL_LOG_FILE
scp -p $LOCAL_LOG_FILE $REMOTE_LOG_FILE
That's all the code i am using. Secondly the script was working fine until i accidentally removed. I am glad i had the print out in front of me. So i am typing exactly the same thing but everytime i run my script it gives me that LOCAL_LOG_FILE not found and REMOTE_LOG_FILE not found.
I have been trying to debug but dont know whats going on. I had my chmod 777 (filename).
what you have done is
LOCAL_LOG_FILE<space>="log_`date +%m%d%Y`"
category_captains.sh[32]: LOCAL_LOG_FILE: not found.
REMOTE_LOG_FILE ="XYZ:/terry/dukes/bkup/${LOCAL_LOG_FILE}"
category_captains.sh[33]: REMOTE_LOG_FILE: not found
you should not leave space in between .
eg
[SIVA ~]$ LOCAL_LOG_FILE="log_`date +%m%d%y`"
[SIVA ~]$ echo $LOCAL_LOG_FILE
log_122807
Create a NFS mount on the remote machine that is exported, granting read/write access to it from the local machine.
Then from the local machine have your script write the logfile to the remote mount.