Created
September 4, 2011 20:39
-
-
Save kristi/1193476 to your computer and use it in GitHub Desktop.
auto-restart passenger
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 | |
# Restarts passenger after any *.py *.html or *.po files are saved | |
# | |
# Requires inotify-tools | |
appDir="/home/user/site.com/appname" | |
siteDir=$(dirname "$appdir") | |
# Make sure app directory exists | |
if [[ ! -e "$appDir" ]] ; then | |
echo "'$appDir' does not exist" | |
fi | |
# Create tmp dir if necessary | |
if [[ ! -e "$siteDir/tmp" ]] ; then | |
mkdir "$siteDir/tmp" | |
fi | |
# Check files | |
while true; do | |
inotifywait -e close_write $(find "$dir" -name "*.py" -o -name "*.html" -o -name "*.po") | |
echo "$(date) Restarting..." | |
touch "$siteDir/tmp/restart.txt" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment