Home > database >  Use crontab with python for write in a file.txt
Use crontab with python for write in a file.txt

Time:03-06

Hello I have a problem with crontab, My file sondeCpu.py have a script to return me the value in percentage of the cpu.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 !

CodePudding user response:

Is it working with "2>&1" instead of "2&1" ?

CodePudding user response:

Thanks a lot yes it's working now !

But do you know why this is working only 1 time and not every minute ? I think it can not rewrite how can I solve this problem too ?

  • Related