This commit is contained in:
lrgex
2023-11-14 08:35:54 +03:00
parent 16bbf117c1
commit d4fc47db63
2 changed files with 44 additions and 0 deletions

1
test/kiauh.exp Normal file
View File

@@ -0,0 +1 @@
# an expect script

View File

@@ -0,0 +1,43 @@
#!/bin/bash
cat << "EOF"
██╗ ██████╗ ██████╗ ███████╗██╗ ██╗
██║ ██╔══██╗██╔════╝ ██╔════╝╚██╗██╔╝
██║ ██████╔╝██║ ███╗█████╗ ╚███╔╝
██║ ██╔══██╗██║ ██║██╔══╝ ██╔██╗
███████╗██║ ██║╚██████╔╝███████╗██╔╝ ██╗
╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝
╦╔═┬ ┬┌─┐┌─┐┌─┐┬─┐
╠╩╗│ │├─┘├─┘├┤ ├┬┘
╩ ╩┴─┘┴┴ ┴ └─┘┴└─ v1.5.1
EOF
##################### Starting code #####################
# This script will run on every container start
if ! systemctl is-enabled nginx > /dev/null 2>&1; then
echo "Enabling NGINX..."
systemctl enable nginx
fi
if ! systemctl is-active nginx > /dev/null 2>&1; then
echo "Starting NGINX..."
systemctl start nginx
else
echo "NGINX is already running."
fi
##################### End code #####################
##################### Only for systemd #####################
# Start systemd /lib/systemd/systemd this for systemd to initialize, "log-level=info" is for debugging , "unit=sysinit.target" is for systemd to initialize AS IS for running the container with systemd
exec /lib/systemd/systemd log-level=info unit=sysinit.target
##################### End Only for systemd #####################
exec "$@" & wait # This is needed to run other scripts or commands when running the container like docker run -it --rm backarosa:latest /bin/bash, backup,restore,container_start,container_stop ..etc
#so when you run the container it will run only one command from scripts folder and exit, however commands in line 3 and 4 will run on every docker run - mandatory hard coded -