I want to do something special : when a file is added (by ftp) to a specific folder, a script launch a command. I found a good script but maybe i made a mistake and i don't understand fully what each line said.
the trick is to watch /var/log/vsftpd.log
when a file is uploaded correctly, vsftpd return a line with "OK UPLOAD"
Code: Select all
tail -f /var/log/vsftpd.log | while read line; do
if echo "$line" | grep -q "OK UPLOAD:"; then
filename=$(echo "$line" | cut -d, -f2)
if [ -s "$filename" ]; then
echo "hello"
fi
fi
doneand i want to print hello also when the file uploaded contained RG14 in its filename.
If someone call help me, i spent all night on that...
Thanks