mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 11:20:39 -03:30
21 lines
523 B
Bash
Executable File
21 lines
523 B
Bash
Executable File
#!/bin/env bash
|
|
|
|
if [ $# -lt 2 ]; then
|
|
echo "Usage:"
|
|
echo " autoreload directory command"
|
|
exit 1
|
|
fi
|
|
|
|
last_reload=`date +%s`
|
|
|
|
inotifywait -mrq -e create,delete,attrib,close_write,move --exclude '/awx_devel/awx/ui' $1 | while read directory action file; do
|
|
this_reload=`date +%s`
|
|
since_last=$((this_reload-last_reload))
|
|
if [[ "$file" =~ .*py$ ]] && [[ "$since_last" -gt 1 ]]; then
|
|
echo "File changed: $file"
|
|
echo "Running command: $2"
|
|
eval $2
|
|
last_reload=`date +%s`
|
|
fi
|
|
done
|