Skip to content

Instantly share code, notes, and snippets.

@bagf
Last active May 2, 2018 14:24
Show Gist options
  • Save bagf/c91e79ccae234c0f25f688b956fade53 to your computer and use it in GitHub Desktop.
Save bagf/c91e79ccae234c0f25f688b956fade53 to your computer and use it in GitHub Desktop.
Trigger after FTP upload
#!/bin/sh
# @see https://stackoverflow.com/questions/10956668/run-a-shell-command-when-a-file-is-added
tail -n 0 -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 "/srv/$filename" ]; then
echo "Got: $filename"
#fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment