mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Not auto-reload explicitly STOPPED processes In development/debug workflow sometime we explicitly STOP processes this will make sure auto-reload does not start them back up
28 lines
1.1 KiB
Bash
Executable File
28 lines
1.1 KiB
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|/awx_devel/awx/.*/tests)' $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"
|
|
# if SUPERVISOR_CONFIG_PATH is defined run `supervisorctl -c $SUPERVISOR_CONFIG_PATH` else just run `supervisorctl`
|
|
if [ -n "$SUPERVISOR_CONFIG_PATH" ]; then
|
|
supervisorctl_command="supervisorctl -c $SUPERVISOR_CONFIG_PATH"
|
|
else
|
|
supervisorctl_command="supervisorctl"
|
|
fi
|
|
tower_processes=`$supervisorctl_command status tower-processes:* | grep -v STOPPED | awk '{print $1}' | tr '\n' ' '`
|
|
echo echo "Running command: $supervisorctl_command restart $tower_processes"
|
|
eval $supervisorctl_command restart $tower_processes
|
|
last_reload=`date +%s`
|
|
fi
|
|
done
|