tell application "System Events" to set pwd to POSIX path of container of (path to me) do shell script "launchctl unload -w /System/Library/LaunchDaemons/com.apple.periodic-daily.plist; launchctl unload -w /System/Library/LaunchDaemons/com.apple.periodic-weekly.plist; launchctl unload -w /System/Library/LaunchDaemons/com.apple.periodic-monthly.plist; launchctl unload -w /Library/LaunchDaemons/period.plist; cp -f " & quoted form of pwd & "/period.plist /Library/LaunchDaemons; launchctl load -w /Library/LaunchDaemons/period.plist" with administrator privileges
do shell script "launchctl load -w /System/Library/LaunchDaemons/com.apple.periodic-daily.plist; launchctl load -w /System/Library/LaunchDaemons/com.apple.periodic-weekly.plist; launchctl load -w /System/Library/LaunchDaemons/com.apple.periodic-monthly.plist; launchctl unload -w /Library/LaunchDaemons/period.plist; rm /Library/LaunchDaemons/period.plist" with administrator privileges
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>period</string>
<key>LowPriorityIO</key>
<true/>
<key>Nice</key>
<integer>1</integer>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>d=daily; w=weekly; m=monthly; s=`date +%s`;
r(){ g=/var/log/$1.out; test $s -lt `tail -1 $g` || \
{ /usr/sbin/periodic $1 && echo $[$s + $2] \
>> $g; }; }; r $d 84600; r $w 603000; r $m 2590200
</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>3600</integer>
</dict>
</plist>
html | css | 1020 hits since April 2012 | updated 2020-06-07 | webmaster