-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_config.sh
More file actions
executable file
·39 lines (34 loc) · 919 Bytes
/
update_config.sh
File metadata and controls
executable file
·39 lines (34 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# make sure user is root
user=$(whoami)
if [ $user != 'root' ]; then
echo "this script must be run as the superuser."
exit 1
fi
cd /home/csss-site/csss-site-config
if [ $? -ne 0 ]; then
echo "couldn't enter directory /home/csss-site/csss-site-config."
echo "stopping here."
exit 1
fi
echo "----"
echo "update sudo..."
cp ./sudoers.conf /etc/sudoers.d/csss-site
echo "----"
echo "update nginx..."
cp ./nginx.conf /etc/nginx/sites-available/csss-site
certbot --nginx # reconfigure the server with SSL certificates
nginx -t
# only restart nginx if config is valid
if [ $? -eq 0 ]; then
systemctl restart nginx
fi
echo "----"
echo "update csss-site service..."
systemd-analyze verify ./csss-site.service
# only use new service if it is valid
if [ $? -eq 0 ]; then
cp ./csss-site.service /etc/systemd/system/csss-site.service
systemctl daemon-reload
systemctl restart csss-site.service
fi