Fixed several issues and made some enhancement to make it more robust. now pushing to both gitea server and github.
This commit is contained in:
@@ -36,7 +36,7 @@ term_handler() {
|
||||
# Kill any still-running background processes if they didn't shut down gracefully
|
||||
if [[ -n "$INIT_PID" ]]; then
|
||||
if kill -0 "$INIT_PID" 2>/dev/null; then
|
||||
echo "Init process still running, force killing: $INIT_PID"
|
||||
echo "Init process still running, sending SIGTERM: $INIT_PID"
|
||||
kill "$INIT_PID" 2>/dev/null
|
||||
else
|
||||
echo "Init process already terminated gracefully"
|
||||
@@ -49,9 +49,11 @@ term_handler() {
|
||||
kill "$TAIL_PID" 2>/dev/null
|
||||
fi
|
||||
|
||||
# Stop SSH service
|
||||
echo "Stopping SSH service..."
|
||||
sudo service ssh stop 2>/dev/null || true
|
||||
# Stop SSH service if it was started
|
||||
if [[ "${ENABLE_SSH:-true}" == "true" || "$ENABLE_SSH" == "1" ]]; then
|
||||
echo "Stopping SSH service..."
|
||||
sudo service ssh stop 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "Cleanup completed, exiting..."
|
||||
exit 0
|
||||
@@ -75,8 +77,13 @@ if [[ $LOG_FILE != "/dev/null" ]]; then
|
||||
sudo chown -R "$(id -u):$(id -g)" "$LOG_FILE"
|
||||
fi
|
||||
|
||||
echo "Starting SSH service..."
|
||||
sudo service ssh start
|
||||
# Start SSH service unless explicitly disabled
|
||||
if [[ "${ENABLE_SSH:-true}" == "true" || "$ENABLE_SSH" == "1" ]]; then
|
||||
echo "Starting SSH service..."
|
||||
sudo service ssh start
|
||||
else
|
||||
echo "SSH service disabled (ENABLE_SSH=$ENABLE_SSH)"
|
||||
fi
|
||||
|
||||
# Run initialization commands (last one in background to allow signal handling)
|
||||
# First collect all defined COMMAND_INIT variables
|
||||
|
||||
Reference in New Issue
Block a user