Browse Source

Add systemd start script

install-script
Luke Childs 3 years ago
parent
commit
56623efb22
  1. 49
      scripts/install

49
scripts/install

@ -10,6 +10,7 @@ INSTALL_AVAHI="true"
INSTALL_YQ="true"
INSTALL_DOCKER="true"
INSTALL_DOCKER_COMPOSE="true"
INSTALL_START_SCRIPT="true"
INSTALL_UMBREL="true"
UMBREL_VERSION="release"
UMBREL_REPO="lukechilds/umbrel"
@ -48,6 +49,11 @@ then
INSTALL_DOCKER_COMPOSE="false"
fi
if [[ "${arguments}" = *"--no-install-start-script"* ]]
then
INSTALL_START_SCRIPT="false"
fi
if [[ "${arguments}" = *"--no-install-umbrel"* ]]
then
INSTALL_UMBREL="false"
@ -144,6 +150,41 @@ install_umbrel() {
tar --extract --gzip --strip-components=1 --directory="${UMBREL_INSTALL_PATH}"
}
install_systemd_service() {
echo "
[Unit]
Wants=network-online.target
After=network-online.target
Wants=docker.service
After=docker.service
# This prevents us hitting restart rate limits and ensures we keep restarting
# indefinitely.
StartLimitInterval=0
[Service]
Type=forking
TimeoutStartSec=infinity
TimeoutStopSec=16min
ExecStart=${UMBREL_INSTALL_PATH}/scripts/start
ExecStop=${UMBREL_INSTALL_PATH}/scripts/stop
User=root
Group=root
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=umbrel startup
RemainAfterExit=yes
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target" | sudo tee "/etc/systemd/system/umbrel-startup.service"
sudo chmod 644 "/etc/systemd/system/umbrel-startup.service"
sudo systemctl enable "umbrel-startup.service"
sudo systemctl start "umbrel-startup.service"
sudo journalctl --output cat --no-pager --unit "umbrel-startup.service"
}
main() {
if [[ "${BOOTSTRAPPED}" = "false" ]]
then
@ -219,6 +260,11 @@ EOF
then
install_umbrel
if [[ "${INSTALL_START_SCRIPT}" = "true" ]]
then
install_systemd_service
fi
cat << EOF
,;###GGGGGGGGGGl#Sp
@ -244,9 +290,6 @@ EOF
Umbrel has been sucessfully installed!
You can start Umbrel with "newgrp docker && sudo ${UMBREL_INSTALL_PATH}/scripts/start".
You may want to setup a system service that runs "./scripts/start" and "./scripts/stop" at system startup/shutdown.
EOF
fi
}

Loading…
Cancel
Save