feat: Initial commit
This commit is contained in:
33
entry.sh
Normal file
33
entry.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
EXE="/opt/app/taskqueue-server"
|
||||
|
||||
chown -R appuser:appuser /opt/app
|
||||
chmod -R 777 /opt/app
|
||||
|
||||
#Define cleanup procedure
|
||||
cleanup() {
|
||||
echo "Container stopped, performing cleanup..."
|
||||
pid=$(ps -ef | awk '$8=="'${EXE}'" {print $2}')
|
||||
kill -INT $pid
|
||||
|
||||
while true; do
|
||||
echo "Waiting for process to finish"
|
||||
pid=$(ps -ef | awk '$8=="'${EXE}'" {print $2}')
|
||||
if [ "$pid" == "" ]; then
|
||||
break
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
#Trap SIGTERM
|
||||
trap 'cleanup' SIGTERM
|
||||
|
||||
hostname
|
||||
|
||||
su appuser -c "cd /opt/app && ${EXE}" &
|
||||
|
||||
wait $!
|
||||
sleep 40
|
||||
Reference in New Issue
Block a user