KB Article #181117

script to restart a task automatically

Problem

-- it may happen that a HME task terminates unexpectedly

-- it prevents messages to be processed and cause downtime

-- how to restart the task automatically if it has stopped


Resolution

* here is a shell script that will automatically identify and start/restart every hour a specific HME task that has stopped or crashed; the name of the HME task can be retrieved in Task Monitor

while true ; do
r4edi st_pstop.x4 -a $CORE_LOCAL/config/passwd -s $CORE_STARTER_PORT
'HierchMsgTask_987_1029_1'
r4edi st_pstart.x4 -a $CORE_LOCAL/config/passwd -s $CORE_STARTER_PORT
'HierchMsgTask_987_1029_1'
sleep 3600
done

* it is possible to configure the script to run periodically via crontab.