¡Hyperling.com 2.0! #16
19
cronjob.sh
19
cronjob.sh
@@ -16,11 +16,14 @@ function log {
|
||||
echo -e "`date` : $NAME - $1"
|
||||
}
|
||||
|
||||
function kill-project {
|
||||
# Kill node.js which will complete run.sh and restart any Docker containers.
|
||||
log "Stopping continuous processes!"
|
||||
pkill node
|
||||
}
|
||||
|
||||
function reload-project {
|
||||
## Kill node.js which will complete run.sh and restart any Docker containers.
|
||||
#pkill node
|
||||
# Do not kill program, just use the new files and if run.sh or main.js were
|
||||
# changed then they can get reloaded manually or by the nightly backup.
|
||||
# Nothing to do.
|
||||
log "Project reloaded successfully!"
|
||||
}
|
||||
|
||||
@@ -35,9 +38,17 @@ grep_status="$?"
|
||||
|
||||
log "Pull status is '$git_status', checking for changes is '$grep_status'."
|
||||
|
||||
echo "$output" | grep "main.js"
|
||||
main_changed="$?"
|
||||
echo "$output" | grep "run.sh"
|
||||
run_changed="$?"
|
||||
|
||||
if [[ $git_status != 0 ]]; then
|
||||
log "*** ERROR: Git reported a failure! ***"
|
||||
exit 1
|
||||
elif [[ $git_status == 0 && ($main_changed == 0 || $run_changed == 0) ]]; then
|
||||
log "Either main ('$main_changed'), or run ('$run_changed') were changed!"
|
||||
kill-project
|
||||
elif [[ $git_status == 0 && $grep_status == 0 ]]; then
|
||||
reload-project
|
||||
elif [[ $git_status == 0 && $grep_status != 0 ]]; then
|
||||
|
Reference in New Issue
Block a user