mirror of
https://github.com/msfjarvis/server-config
synced 2025-08-14 12:57:00 +05:30
Merge systemd-units as a subdirectory
This commit is contained in:
commit
f012e7a38c
8 changed files with 232 additions and 0 deletions
27
systemd_units/update.sh
Executable file
27
systemd_units/update.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
CL_RST="\033[0m"
|
||||
CL_YLW="\033[01;33m"
|
||||
|
||||
function prettyPrint {
|
||||
echo -e "${CL_YLW}${1}${CL_RST}"
|
||||
}
|
||||
|
||||
# Grab all service names
|
||||
declare -a services=('caddy' 'gitea' 'horbiswalls-bot' 'mirror-bot' 'mirror-bot-2' 'uno-bot' 'walls-bot' 'walls-bot-2')
|
||||
|
||||
# Now loop through each service and install it
|
||||
for service in "${services[@]}"; do
|
||||
if [ "${1}" ] && [[ "${service}" != "${1}" && "${service}.service" != "${1}" ]]; then
|
||||
continue
|
||||
fi
|
||||
prettyPrint "Installing ${service}"
|
||||
sudo cp -v "${service}.service" /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
prettyPrint "Restarting ${service}"
|
||||
sudo systemctl restart "${service}"
|
||||
if [ ! -f "/etc/systemd/system/multi-user.target.wants/${service}.service" ]; then
|
||||
prettyPrint "Enabling ${service}"
|
||||
sudo systemctl enable "${service}"
|
||||
fi
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue