Hello,
In a script in Linux, I need to write a text file, and then change its owner. The script will run as a cron job.
The following script doesn't work, without triggering an error.
What's the right way to proceed?
Thank you.
In a script in Linux, I need to write a text file, and then change its owner. The script will run as a cron job.
The following script doesn't work, without triggering an error.
What's the right way to proceed?
Thank you.
#!/usr/bin/python3 """ apt install python3-os E: Unable to locate package python3-os """ import os OUTPUTFILE = "/usr/share/nginx/html/blah.html" f = open(OUTPUTFILE, 'w', encoding='utf-8') #stuff here f.write("blah") f.close() #-rw-r--r-- 1 root root os.system(f"chown www:www {OUTPUTFILE}")