Last active
October 11, 2017 00:04
-
-
Save devm33/f04564507762a3a0e8380c5b1e145876 to your computer and use it in GitHub Desktop.
Monitor directory for deletion and then push.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:gitpush] | |
command=/home/devm33/gitpush.sh | |
autostart=true | |
autorestart=true | |
startretries=3 | |
stderr_logfile=/var/log/gitpush.err.log | |
stdout_logfile=/var/log/gitpush.out.log | |
user=devm33 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DELDIR='/var/www/html/wp-content/plugins/simply-static/static-files/' | |
cd /var/www/static | |
# git needs $HOME - supervisor doesnt supply it | |
export HOME=/home/devm33 | |
echo "Started monitoring $(date)" | |
while inotifywait -q -e delete_self $DELDIR; do | |
echo "Triggered $(date) $DELETED, waiting before running git" | |
sleep 3 | |
git add -A && git commit -am "Auto commit $(date)" && git push origin master && echo "Success" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment