-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathreboot.sh
More file actions
41 lines (34 loc) · 759 Bytes
/
reboot.sh
File metadata and controls
41 lines (34 loc) · 759 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
40
41
#!/bin/bash
# Reboot system with countdown
# Usage: ./reboot.sh [--dry-run]
if [ "$1" = "--dry-run" ]; then
echo "🔍 DRY RUN MODE - System would reboot but won't"
echo "=================================================="
echo ""
echo "The system would show a 10-second countdown, then reboot."
echo ""
echo "To actually reboot, run without --dry-run"
exit 0
fi
echo "🔄 System Reboot"
echo "=================="
echo ""
# Check for sudo
if [ "$EUID" -ne 0 ]; then
SUDO="sudo"
else
SUDO=""
fi
echo "⚠️ This will reboot the system!"
echo ""
echo "To cancel, press Ctrl+C"
echo ""
# Countdown
for i in {10..1}; do
echo -ne "\rRebooting in $i seconds... "
sleep 1
done
echo ""
echo ""
echo "🔄 Rebooting now..."
$SUDO reboot