I have cronjobs doing various cleanup tasks:
$ crontab -l
0 * * * * find ${HOME}/Downloads -depth 1 -d -mtime +12h -exec /usr/local/bin/trash {} \;
* * * * * /usr/bin/defaults delete com.apple.Spotlight userHasMovedWindow > /dev/null
* * * * * /usr/bin/defaults delete com.apple.Spotlight windowHeight > /dev/null
However, it seems the jobs, for some reason, never exits. Instead they linger on and show as (cron)
companioned by either (find)
or (defaults)
in the output of ps
and in the activity monitor.
It happens for all jobs.
After hours or days, the computer freezes as the OS won't allow any more processes to spawn.
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.15
BuildVersion: 19A583
Best Answer
Redirect
stderr
to/dev/null
as well asstdout
:From trial and error it seems to be the
stderr
output of those commands that prevents the cronjob from exiting. I have no clue why that is, but it may be related to permissions to mail the output.