-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapache_manager.sh
executable file
·87 lines (73 loc) · 2.4 KB
/
apache_manager.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
f35b04
while true; do
clear
text="\e[1m Apache Manager \e[0m"
footer="\e[1m \e[0m"
color="\e[48;2;243;91;4m"
width=$(tput cols)
padding=$((($width - ${#text}) ))
echo -ne "${color}${text}\033[0m\n"
echo "==========================================="
echo " 1. Install Apache "
echo " 2. Start Apache "
echo " 3. Stop Apache "
echo " 4. Restart Apache "
echo " 5. Reload Apache "
echo " 6. Check Apache Status "
echo " 7. Enable Site "
echo " 8. Disable Site "
echo " 0. Exit "
echo "==========================================="
echo -n " Enter your choice: "
read choice
case $choice in
1) echo "Installing Apache..."
sudo apt update
sudo apt install apache2
read -p "Press any key to continue..."
;;
2) echo "Starting Apache..."
sudo systemctl start apache2
read -p "Press any key to continue..."
;;
3) echo "Stopping Apache..."
sudo systemctl stop apache2
read -p "Press any key to continue..."
;;
4) echo "Restarting Apache..."
sudo systemctl restart apache2
read -p "Press any key to continue..."
;;
5) echo "Reloading Apache..."
sudo systemctl reload apache2
read -p "Press any key to continue..."
;;
6) echo "Apache Status:"
sudo systemctl status apache2
read -p "Press any key to continue..."
;;
7) echo "Available sites:"
ls /etc/apache2/sites-available
echo -n "Enter the site name to enable: "
read site
sudo a2ensite $site
sudo systemctl reload apache2
read -p "Press any key to continue..."
;;
8) echo "Enabled sites:"
ls /etc/apache2/sites-enabled
echo -n "Enter the site name to disable: "
read site
sudo a2dissite $site
sudo systemctl reload apache2
read -p "Press any key to continue..."
;;
0) echo "Exiting..."
exit 0
;;
*) echo "Invalid option..."
read -p "Press any key to continue..."
;;
esac
done