How can root launch a regular Mac application from a cron job in /etc/crontab? I want the cronjob to do some things as the superuser, and depending on the result, launch an app as me, the logged-in user.

I've tried a bunch of things but nothing I think should work does.

Similar questions: 


How can I execute sudo commands as a cron job?
How can I automatically launch an application whenever the Mac goes idle?
I figured out the key was to use su with -l, -c and single quotes:

su -l myloginname -c '/usr/bin/open -a [App].app'


In context:

*/15 * * * * root if { !  /usr/bin/diff  /var/tmp/foo /var/backups/bar &gt;&gt; /var/log/foobar-diff.log ; } ; \
then  /usr/bin/su -l myloginname -c '/usr/bin/open -a /Applications/iProcrastinate.app &gt; /dev/null 2&gt; /dev/null' ; \
/bin/date &gt;&gt; /var/log/foobar-diff.log ; fi