-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Delayed Policy Trigger Disable.bash
74 lines (53 loc) · 2.04 KB
/
Delayed Policy Trigger Disable.bash
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
####################################################################################################
#
# ABOUT
#
# Disable a LaunchDaemon
#
####################################################################################################
#
# HISTORY
#
# Version 1.0.0, 24-Aug-2015, Dan K. Snelson
# Original version
# Inspired by Kyle Brockman (brockma9)
# https://jamfnation.jamfsoftware.com/discussion.html?id=6990
# Version 1.1.0, 02-Nov-2017, Dan K. Snelson
# Updated log writing
# Version 1.1.1, 17-Aug-2019, Dan K. Snelson
# Updates for macOS Catalina
#
####################################################################################################
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Variables
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
plistDomain="com.company" # Hard-coded domain name (i.e., "com.company")
plistLabel="${4}" # Unique label for this plist (i.e., "presentationMode2")
plistFilename="${plistDomain}.${plistLabel}.plist" # Prepend domain to label
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Program
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
echo "Delayed Policy Trigger Disable"
echo "• Filename: ${plistFilename}"
if [ -f "/Library/LaunchDaemons/${plistFilename}" ] ; then
# Disable launchd plist
echo "• Disable ${plistFilename} ..."
/usr/bin/defaults write /Library/LaunchDaemons/${plistFilename} Disabled -bool true
# Unload launchd plist
#echo "• Unload ${plistFilename} ..."
#/bin/launchctl unload -wF /Library/LaunchDaemons/${plistFilename}
# Delete launchd plist
echo "• Delete ${plistFilename} ..."
/bin/rm -f /Library/LaunchDaemons/${plistFilename}
echo "• plist ${plistLabel} cleared"
# Send result back to the Jamf Pro server
echo "Disabled and deleted ${plistFilename}"
else
echo "File ${plistFilename} not found."
fi
exit 0