Hi,
I'm running an old motioneye distro on a Zero 2 with python 2.7. It's working fine but it has filenames read-write only.
Because I'd like to run a Python script which updates a log file, I'm not able to do it automatically because of the locked filesystem.
If I issue os.system("mount -o remount,rw /") it works and I can update my log file accordingly.
So, I added @reboot mount -o remount,rw / in crontab but it doesn't work. rc.local and systemd are not available.
I also added the below code in my script but, with no avail.
Is there another solution to my problem?
TIA
I'm running an old motioneye distro on a Zero 2 with python 2.7. It's working fine but it has filenames read-write only.
Because I'd like to run a Python script which updates a log file, I'm not able to do it automatically because of the locked filesystem.
If I issue os.system("mount -o remount,rw /") it works and I can update my log file accordingly.
So, I added @reboot mount -o remount,rw / in crontab but it doesn't work. rc.local and systemd are not available.
I also added the below code in my script but, with no avail.
Is there another solution to my problem?
TIA
Code:
def write_to_log(message): if os.system("mount | grep 'on / ' | grep -q rw") == 0: with open("/home/log.txt", "a") as log_file: # Open in append mode timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S") log_file.write("{} - {}\n".format(timestamp, message)) else: os.system("mount -o remount,rw /")
Statistics: Posted by ebolisa — Tue Dec 24, 2024 5:52 pm