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:
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:
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 >> /var/log/foobar-diff.log ; } ; \
then /usr/bin/su -l myloginname -c '/usr/bin/open -a /Applications/iProcrastinate.app > /dev/null 2> /dev/null' ; \
/bin/date >> /var/log/foobar-diff.log ; fi
IMO it's much easier to suspend these launches and resume them on demand by commenting and uncommenting the relevant line.
I thought stackexchange wasn't the place for religious wars!
– WHO'sNoToOldRx4Covid-CENSORED Apr 04 '13 at 20:37