-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdateInexad
executable file
·37 lines (25 loc) · 932 Bytes
/
updateInexad
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
#!/bin/bash
# Configuration
root="/srv/http"
app="inexad"
dev_path="/home/commander/Projects/HTML/"
# Font
bold="\e[1m"
red="\e[91m"
green="\e[92m"
blink="\e[5m"
# Reset all attributes
reset="\e[0m"
echo -e "$red$bold$blink[Updating Server]$reset"
sudo sed -i "s/^DocumentRoot\ \"\/srv\/http\/.*/DocumentRoot\ \"\/srv\/http\/${app}\"/" /etc/httpd/conf/httpd.conf
sudo sed -iE "/^<Directory\ \"\/srv\/http\/cgi/!s/^<Directory\ \"\/srv\/http\/.*/<Directory\ \"\/srv\/http\/${app}\">/" /etc/httpd/conf/httpd.conf
echo -e "$red$bold[Removing old $app dir...]$reset"
sudo rm -r --preserve-root "$root"/"$app"
echo -e "$red$bold[Moving files from development dir...]$reset"
sudo cp -R "$dev_path"/"$app" "$root"
echo -e "$red$bold[Updating permissions...]$reset"
sudo chown -R http:http "$root"/"$app"
echo -e "$red$bold[Restarting apache2...]$reset"
sudo systemctl restart httpd
echo -e "$green$bold[Complete!]$reset"
exit 0