Posted on 09-13-2018 02:30 AM
Hello,
what is the best way if i want to disable sleep for 3 hours while installing on macs which have a configuration profile which sets sleep to 15 minutes. The profile is installed at enrollment after this i run a policy by custom trigger which runs a script with different custom triggers.
Should i just use caffeinate at the beginning of the script?
Should i make a new configuration profile with new sleep settings? Does it overwrite the old 15 minutes? I would like to do everything in the script and not to use an additional step in the jss.
Is there another good way?
Thanks in advance
Maurice Fiedler
Solved! Go to Solution.
Posted on 09-13-2018 04:00 PM
I just used caffeinate in a seperate script (it seperates the command away so other scripts can be run after).
I name it alphabetically so it runs prior to the other scripts.
It defaults to 3 hours but you can pass it a $4 parameter of however many hours you want up to 48.
I think it still works...
#!/bin/sh
declare -i LIVE_TIME
LIVE_TIME=10800
if [[ "$4" -gt "0" ]] && [[ "$4" -lt "49" ]]; then
LIVE_TIME=$4*3600
fi
echo Machine will not sleep for $LIVE_TIME seconds.
( caffeinate -sid -t $LIVE_TIME ) &
disown
exit
Posted on 09-13-2018 04:00 PM
I just used caffeinate in a seperate script (it seperates the command away so other scripts can be run after).
I name it alphabetically so it runs prior to the other scripts.
It defaults to 3 hours but you can pass it a $4 parameter of however many hours you want up to 48.
I think it still works...
#!/bin/sh
declare -i LIVE_TIME
LIVE_TIME=10800
if [[ "$4" -gt "0" ]] && [[ "$4" -lt "49" ]]; then
LIVE_TIME=$4*3600
fi
echo Machine will not sleep for $LIVE_TIME seconds.
( caffeinate -sid -t $LIVE_TIME ) &
disown
exit