Files
ubuntu/scripts/entrypoint.sh
Ameer Hamza 10477a6671
All checks were successful
continuous-integration/drone/push Build is passing
Fixed the creation and permissions on log file.
2023-12-11 13:04:57 +08:00

27 lines
537 B
Bash
Executable File

#!/usr/bin/env bash
set -x
term_handler() {
eval $USER_COMMAND_EXIT
eval $SYS_COMMAND_EXIT
exit 143; # 128 + 15 -- SIGTERM
}
# setup handler when the container is exited
trap 'kill ${!}; term_handler' SIGTERM
# setup home directory for the current user. It is useful for attaching vscode with container.
sudo mkhomedir_helper `whoami`
if [[ $LOG_FILE != "/dev/null" ]];
then
sudo touch $LOG_FILE
sudo chown -R $(id -u):$(id -g) $LOG_FILE
fi
eval $SYS_COMMAND_INIT
eval $USER_COMMAND_INIT &
tail -f $LOG_FILE & wait ${!}