From e8acfeae93b97db8df84223f96943a35f1492c9b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 18 Jul 2019 08:21:38 +0000 Subject: [PATCH] Allow updating singular units Signed-off-by: Harsh Shandilya --- update.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/update.sh b/update.sh index 3308c05..f1aaceb 100755 --- a/update.sh +++ b/update.sh @@ -10,16 +10,14 @@ function prettyPrint { # Grab all service names declare -a services=('caddy' 'horbiswalls-bot' 'mirror-bot' 'uno-bot') -# Place the systemd unit files where they belong -prettyPrint "Copying systemd files to /etc/systemd/system" -for service in "${services[@]}"; do sudo cp -v "${service}.service" /etc/systemd/system/; done - -# Reload systemctl so that it processes our changes -prettyPrint "Reloading systemctl daemon" -sudo systemctl daemon-reload - -# Now loop through each service and restart it +# Now loop through each service and install it for service in "${services[@]}"; do + if [ "${1}" ] && [ "${service}" != "${1}" ]; then + continue + fi + prettyPrint "Installing ${service}" + sudo cp -v "${service}.service" /etc/systemd/system/ + sudo systemctl daemon-reload prettyPrint "Restarting ${service}" sudo service "${service}" restart if [ ! -f "/etc/systemd/system/multi-user.target.wants/${service}.service" ]; then