Skip to content

Commit

Permalink
Monitor AMP and run scheduled tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchTalmadge committed Oct 30, 2023
1 parent 781f419 commit 5857976
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions entrypoint/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ trap "stop_amp" SIGTERM

# Sleep
echo "AMP is now running. Logs can be viewed through AMP web UI or at ampdata/instances/Main/AMP_Logs"
monitor_amp &
tail -f /dev/null &
wait $!
8 changes: 8 additions & 0 deletions entrypoint/routines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,14 @@ handle_error() {
exit 1
}

monitor_amp() {
# Periodically process pending tasks (e.g. upgrade, reboots, ...)
while true; do
run_amp_command_silently "ProcessPendingTasks"
sleep 5 # The UI's restart timeout is 10 seconds, so let's be safe.
done
}

run_startup_script() {
# Users may provide their own startup script for installing dependencies, etc.
STARTUP_SCRIPT="/home/amp/scripts/startup.sh"
Expand Down
4 changes: 4 additions & 0 deletions entrypoint/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ does_main_instance_exist() {

run_amp_command() {
su ${APP_USER} --command "ampinstmgr $1"
}

run_amp_command_silently() {
su ${APP_USER} --command "ampinstmgr --silent $1"
}

0 comments on commit 5857976

Please sign in to comment.