diff options
| author | Blista Kanjo | 2023-06-01 13:55:56 -0400 |
|---|---|---|
| committer | Blista Kanjo | 2023-06-01 13:55:56 -0400 |
| commit | 903d9a03a2d515f865f7212276d28c287aebbaee (patch) | |
| tree | b6cf4df5de51389e7b1a634b1cfa95766aa08ea9 /.local/share | |
| parent | 482e8af041d7e40f74c47f5dba1544dae46cf6e1 (diff) | |
refactor: request sudo before timedatectl commands
Diffstat (limited to '.local/share')
| -rwxr-xr-x | .local/share/scripts/dateTime.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/.local/share/scripts/dateTime.sh b/.local/share/scripts/dateTime.sh index 427ed6a..c9c7d90 100755 --- a/.local/share/scripts/dateTime.sh +++ b/.local/share/scripts/dateTime.sh @@ -6,11 +6,11 @@ read -r automatic_time_input if [ "$automatic_time_input" = "y" ] || [ "$automatic_time_input" = "Y" ]; then # Synchronize the system time automatically using NTP - timedatectl set-ntp true + sudo timedatectl set-ntp true echo "Automatic time synchronization using NTP initiated." automatic_timezone=$(curl --fail https://ipapi.co/timezone 2>/dev/null) if [ -n "$automatic_timezone" ]; then - timedatectl set-timezone "$automatic_timezone" + sudo timedatectl set-timezone "$automatic_timezone" echo "Automatic timezone setting complete." else echo "Automatic timezone setting failed. Please set the timezone manually." @@ -26,11 +26,11 @@ else read -r timezone_input # Override NTP setting - timedatectl set-ntp false + sudo timedatectl set-ntp false # Set the system date and time - timedatectl set-time "$date_input $time_input" + sudo timedatectl set-time "$date_input $time_input" # Set the system timezone - timedatectl set-timezone "$timezone_input" + sudo timedatectl set-timezone "$timezone_input" echo "Manual date and time setting complete." fi |
