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:
#!/bin/bash
/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:
#!/bin/bash
/usr/bin/screen -d -m -S taskname /usr/bin/nice mycommand
w00t!
-------
Please consider crypto tipping:
No comments:
Post a Comment
Comments, Suggestions or "Thank you's" Invited! If you have used this info in any way, please comment below and link/link-back to your project (if applicable). Please Share.
I accept Bitcoin tips of ANY amount to: 1GS3XWJCTWU7fnM4vfzerrVAxmnMFnhysL
I accept Litecoin tips of ANY amount to: LTBvVxRdv2Lz9T41UzqNrAVVNw4wz3kKYk