OSX crontab (cronjob) with GNU "screen" fails to run reporting "Must be connected to a terminal."
I had set a cronjob to run using the "screen" command,
0 * * * * /path/to/script.sh
where my script is:
/usr/bin/screen -S taskname /usr/bin/nice mycommand
but it failed to run. To figure out the problem, i redirected output to a log.
0 * * * * /path/to/script.sh > ~/mylog.log
The log reported "Must be connected to a terminal."
The solution is to add the -d -m options to screen:
/usr/bin/screen -d -m -S taskname /usr/bin/nice mycommand