mirror of
https://github.com/msfjarvis/server-config
synced 2025-08-14 01:17:02 +05:30
This reverts commit d4c08a3c62
.
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
47 lines
1.4 KiB
Bash
Executable file
47 lines
1.4 KiB
Bash
Executable file
#!/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' 'goaccess' 'mirror-bot' 'mirror-bot-2' 'uno-bot' 'pyrobud' 'walls-bot' 'walls-bot-rs')
|
|
declare -a timers=('goaccess-update')
|
|
|
|
# Now loop through each service and install it
|
|
for service in "${services[@]}"; do
|
|
if [ "${1}" ] && [[ ${service} != "${1}" && "${service}.service" != "${1}" ]]; then
|
|
continue
|
|
fi
|
|
prettyPrint "Checking root access"
|
|
sudo -v || return 1
|
|
prettyPrint "Installing ${service}"
|
|
sudo cp -v "${service}.service" /etc/systemd/system/
|
|
sudo systemctl daemon-reload
|
|
if [ -z "${NO_RESTART}" ]; then
|
|
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
|
|
fi
|
|
done
|
|
|
|
for timer in "${timers[@]}"; do
|
|
if [ "${1}" ] && [[ ${timer} != "${1}" && "${timer}.timer" != "${1}" ]]; then
|
|
continue
|
|
fi
|
|
prettyPrint "Checking root access"
|
|
sudo -v || return 1
|
|
prettyPrint "Installing ${timer}"
|
|
sudo cp -v "${timer}.timer" /etc/systemd/system/
|
|
sudo systemctl daemon-reload
|
|
if [ -z "${NO_RESTART}" ]; then
|
|
prettyPrint "Enabling ${timer}"
|
|
sudo systemctl enable "${timer}.timer"
|
|
fi
|
|
done
|