Skip to content

Instantly share code, notes, and snippets.

@sumonst21
Created June 17, 2022 22:06
Show Gist options
  • Save sumonst21/9fc5452b4344ef1c9eddf29304efb011 to your computer and use it in GitHub Desktop.
Save sumonst21/9fc5452b4344ef1c9eddf29304efb011 to your computer and use it in GitHub Desktop.
for a client
inotifywait -m ~/public_html -e create -e moved_to -e modify |
while read directory action file; do
if [[ "$file" =~ .*php$ ]] || [[ "$file" =~ .*htaccess$ ]]; then
echo "File $file was $action" >> ~/watch.log
~/watchit.sh
fi
done
cd ~/public_html
git fetch origin master
git reset --hard origin/master
time=`date +%Y-%m-%d.%H:%M:%S`
echo $time >> ~/watchit.log
find ~/public_html -type f -perm 0444 -name ".htaccess" -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment