0

I have a problem with crontab. My file sondeCpu.py has a script to return me the cpu-load percentage. I want the result every minute and I want the output to go to my file Sample.txt

01 * * * * python3 /home/z/sondeCpu.py >> /home/z/Sample.txt 2&1

The script in sondeCpu.py work well alone in the terminal but in crontab the output does not want to go in Sample.txt.

I need some help Thanks you !

Icoryx
  • 96
  • 7

1 Answers1

1

Is it working with "2>&1" instead of "2&1" ? Also, for performing it every minute use "*/1" instead of "1". With your version it would be executed in the first minute of every hour.

*/1 * * * * python3 /home/z/sondeCpu.py >> /home/z/Sample.txt 2>&1

(Ref. crontab https://wiki.ubuntuusers.de/Cron )

miro
  • 67
  • 6