-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisable.sh
More file actions
executable file
·34 lines (29 loc) · 898 Bytes
/
disable.sh
File metadata and controls
executable file
·34 lines (29 loc) · 898 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
#!/bin/bash
# Check if the script is run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "Not running as root"
exit
fi
# Change directory to the parent of the script directory
cd "$(dirname "$0")/.."
# Check for virtual environment
if [ ! -d ".venv" ]; then
echo "Environment not initialized, please run setup.sh first"
exit
fi
# Check for service name argument
if [ -n "$1" ]; then
echo "Disabling service balloon-$1.service"
systemctl disable balloon-"$1".service
exit
fi
# Disable all services
echo "No service name argument provided, disabling all services"
for service in /etc/systemd/system/balloon-*.service; do
if [ "$service" == "/etc/systemd/system/balloon-*.service" ]; then
echo "No systemd service files found"
break
fi
echo "Disabling service $(basename "$service")"
systemctl disable "$(basename "$service")"
done