Posted on 10-31-2019 03:51 PM
I'm working on a policy that calls a second policy:
Policy1 - install X piece of Software (don't force restart)
Policy2 - Force a restart using a Jamf helper script set with a 2.5 hour time limit. (management request) The script creates a custom window with logo and is using an adaption of Bill Smith's Countdown script. https://gist.github.com/talkingmoose/3d405eb9dc8ce99a48cda9d9f7609a4f
Policy 1 ends with 'File and Processes' call to start the second policy. Has anyone found a way to handle the difference between Catalina and pre-Catalina?
Pre-catalina: /usr/bin/local/jamf policy -event 'ForcedRestart'
Catalina: /usr/bin/local/jamf/bin/jamf policy -event 'ForcedRestart'
You may ask why I'm using the 2 policies instead of an after script. It seems that when set up with the ForcedRestart script - I wasn't getting the complete tag on policies... they stayed pending....
Solved! Go to Solution.
Posted on 11-01-2019 08:45 AM
The solution - thank you Abbie in support.... Don't use the full path in "Files and Processes" just use the Jamf command:
jamf policy -event ForcedRestart
tested and working in both older OSes and Catalina
(that's what I get for using full paths... ;-} )
Posted on 11-01-2019 01:47 AM
'which jamf' gives me '/usr/local/bin/jamf' even on macOS 10.15. I have several policies that use '/usr/local/bin/jamf', and they continue to work under Catalina. So I see no need to find out the OS version and use a separate path for Catalina.
I think it is ages ago that jamf was not under /usr/local. Wait, which JSS version are you using?
Posted on 11-01-2019 03:22 AM
You can use some code to sort out the links to the Jamf binary:
Cant remember who I got this from but it was on this board
if [ -L "/usr/local/bin" ] ; then
rm "/usr/local/bin"
mkdir "/usr/local/bin"
ln -s "/usr/local/jamf/bin/jamf" "/usr/local/bin/jamf"
ln -s "/usr/local/jamf/bin/jamfAgent" "/usr/local/bin/jamfAgent"
chown -R root:wheel "/usr/local/bin"
fi
Posted on 11-01-2019 08:45 AM
The solution - thank you Abbie in support.... Don't use the full path in "Files and Processes" just use the Jamf command:
jamf policy -event ForcedRestart
tested and working in both older OSes and Catalina
(that's what I get for using full paths... ;-} )
Posted on 11-04-2019 01:36 AM
I think that is a bad recommendation. I would recommend to always use full paths in scripts - just to make sure that I execute exactly the command that I want and not something else that has the same name and sits somewhere on the paths, or an alias to the same or another command which some unsuitable options applied.