The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 6,522     Votes:  1     ✅ Solution
Tags: scripts   cron  
Link: 🔍 See Original Answer on Ask Ubuntu ⧉ 🔗

URL: https://askubuntu.com/q/1188181
Title: Output redirection to a file, used inside script, is not working when executed from crontab
ID: /2019/11/12/Output-redirection-to-a-file_-used-inside-script_-is-not-working-when-executed-from-crontab
Created: November 12, 2019
Upload: April 8, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


logs/testpad1.log will behave differently depending on your current directory. It can also behave differently depending if cron is running as root or you are calling the script from your terminal.

The safe (and usually error correcting) thing to do is hard code the full path into the file name:

/home/me/scripts/logs/testpad1.log
/var/log/testpad1.log
⇧ Run script every 4 minutes but don't run from 3:00 to 3:40 Dedicated GPU increases idling temps  ⇩