From f0ab5dc8aebbd3d4e768c0760259d25e8e025bec Mon Sep 17 00:00:00 2001 From: Bob Gendler Date: Wed, 6 Mar 2024 11:46:39 -0500 Subject: [PATCH] fix[rules] updated location services rules Changed kickstart to find the PID and do a kill -9 to the PID Issue #372 --- .../system_settings_location_services_disable.yaml | 4 +++- .../system_settings_location_services_enable.yaml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rules/system_settings/system_settings_location_services_disable.yaml b/rules/system_settings/system_settings_location_services_disable.yaml index a9760b06..543070a6 100644 --- a/rules/system_settings/system_settings_location_services_disable.yaml +++ b/rules/system_settings/system_settings_location_services_disable.yaml @@ -14,7 +14,9 @@ result: fix: | [source,bash] ---- - /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -bool false; /bin/launchctl kickstart -k system/com.apple.locationd + /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -bool false; + pid=$(/bin/launchctl list | /usr/bin/awk '/com.apple.locationd/ { print $1 }') + kill -9 $pid ---- references: cce: diff --git a/rules/system_settings/system_settings_location_services_enable.yaml b/rules/system_settings/system_settings_location_services_enable.yaml index 3e97e97b..a705b5a3 100644 --- a/rules/system_settings/system_settings_location_services_enable.yaml +++ b/rules/system_settings/system_settings_location_services_enable.yaml @@ -12,7 +12,9 @@ result: fix: | [source,bash] ---- - /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -bool true; /bin/launchctl kickstart -k system/com.apple.locationd + /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -bool enable; + pid=$(/bin/launchctl list | /usr/bin/awk '/com.apple.locationd/ { print $1 }') + kill -9 $pid ---- references: cce: