mirror of
https://github.com/msfjarvis/server-config
synced 2025-08-14 22:16:59 +05:30
Add an update script
Truth be told I got tired as shit of doing it again and again by hand lol Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
This commit is contained in:
parent
7c17937d4b
commit
8ab76bc901
1 changed files with 32 additions and 0 deletions
32
update.sh
Executable file
32
update.sh
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
CL_RST="\033[0m"
|
||||
CL_YLW="\033[01;33m"
|
||||
|
||||
function reportWarning {
|
||||
echo -e ""
|
||||
echo -e ${CL_YLW}"${1}"${CL_RST}
|
||||
if [[ -z ${2} ]]; then
|
||||
echo -e ""
|
||||
fi
|
||||
}
|
||||
|
||||
# Grab all service names
|
||||
services=$(ls *.service | cut -d '.' -f 1)
|
||||
|
||||
# Place the systemd unit files where they belong
|
||||
reportWarning "Copying systemd files to /etc/systemd/system"
|
||||
sudo cp *.service /etc/systemd/system/
|
||||
|
||||
# Reload systemctl so that it processes our changes
|
||||
reportWarning "Reloading systemctl daemon"
|
||||
systemctl daemon-reload
|
||||
|
||||
# Sleep for 5 seconds to let systemctl get it's shit together
|
||||
sleep 5
|
||||
|
||||
# Now loop through each service and restart it
|
||||
for service in ${services};do
|
||||
reportWarning "Restarting ${service}"
|
||||
service ${service} restart
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue