I have written a short script to upload a log to my ftp server, you can ignore everything apart from the last line which is supposed to restart rsyslog. Executing the command from the command line works fine but it doesn't work in the script file. Can anybody help ?
#!/bin/bash mv /var/log/rtx8660.log /home/vocovo/RTX8660_$(date +"%Y-%m-%d-%H_%M").log touch /var/log/rtx8660.log cd /home/vocovo FTPLOG=/tmp/ftplogfile ftp -inv <<! > $FTPLOG open SERVER user USER PASS cd /Wickes_Test prompt mput RTX* close quit ! FTP_SUCCESS_MSG="226 Transfer complete" if fgrep "$FTP_SUCCESS_MSG" $FTPLOG ;then echo "ftp OK" rm RTX* else echo "ftp Error: "$OUT fi exit 0 service rsyslog restart