-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuninstall
More file actions
31 lines (24 loc) · 1.06 KB
/
Copy pathuninstall
File metadata and controls
31 lines (24 loc) · 1.06 KB
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
#!/bin/bash
echo "Starting uninstallation of hcpp-redis..."
# 1. Find all Hestia users and stop/disable their Redis services.
# We iterate through the home directories as a reliable way to find users.
for user in $(ls /home); do
if [ -d "/home/$user/redis" ]; then
echo "Disabling Redis for user: $user"
# The --now flag stops the service immediately and disables it.
systemctl disable --now redis-user@$user.service >/dev/null 2>&1
echo "Removing Redis directory for user: $user"
rm -rf /home/$user/redis
fi
done
# 2. Remove the systemd template file.
echo "Removing systemd service template..."
rm -f /etc/systemd/system/redis-user@.service
# 3. Reload the systemd daemon to apply the changes.
echo "Reloading systemd daemon..."
systemctl daemon-reload
# 4. (Optional) Remove the Redis server package itself.
# Uncomment the line below if you want to completely remove Redis from the system.
# echo "Purging redis-server package..."
# apt-get remove --purge -y redis-server
echo "hcpp-redis uninstallation complete."