Hello Everyone,
I have written below shell script to scp last modified log file.
This script works fine when I directly execute it. However when I schedule this script under cron jobs, "scp $temp itmuser@192.168.201.138:/home/itmuser/XLMEDIA_Logs/jetedgede" part of the script does not work.Code:cd /data/logs/apache/ ls -trl | grep access-icecast.log.* | tail -1 | awk '{print $8}' | while read temp; do echo "This is before scp" > /tmp/before.txt scp $temp itmuser@192.168.201.138:/home/itmuser/XLMEDIA_Logs/jetedgede echo "This is after scp" > /tmp/after.txt done
Can anyone please suggest me what modification is required in the script so that it works when scheduled under cron jobs?
Thank you.

Reply With Quote

