Script on ramdisk, advice?

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
Wolfgan
Posts: 16
Joined: Tue May 31, 2016 10:56 pm

Script on ramdisk, advice?

Post by Wolfgan »

Hi,
I integrated a python script to read ambient temperature and humidity and display it via RpiMonitor (see http://rpi-experiences.blogspot.com/201 ... idity.html).

As the script executes every 2', I want it to run from a tmpfs ramdisk location to improve system performance and SD wear. I was thinking cron running it from /run , but I wonder what's the best strategy to copy the .py script in there at boot time.
Any suggestions / best practices? Thx, Wolf

PS: BTW, the script produces a txt file to be parsed by RpiMonitor, I pushed it to /var as this is also a tmpfs location.
User avatar
Fourdee
Site Admin
Posts: 2788
Joined: Tue Feb 06, 2007 1:36 pm

Re: Script on ramdisk, advice?

Post by Fourdee »

Wolfgan wrote:Hi,
I integrated a python script to read ambient temperature and humidity and display it via RpiMonitor (see http://rpi-experiences.blogspot.com/201 ... idity.html).

As the script executes every 2', I want it to run from a tmpfs ramdisk location to improve system performance and SD wear. I was thinking cron running it from /run , but I wonder what's the best strategy to copy the .py script in there at boot time.
Any suggestions / best practices? Thx, Wolf

PS: BTW, the script produces a txt file to be parsed by RpiMonitor, I pushed it to /var as this is also a tmpfs location.

Code: Select all

/etc/rc.local
Its the last script to run at the end of boot. So cp the python script from there.

How is the python script started? Might need to run the cp earlier.
If you find our project or support useful, then we’d really appreciate it if you’d consider contributing to the project however you can.
Donating is the easiest – you can use PayPal or become a DietPi patron.
Wolfgan
Posts: 16
Joined: Tue May 31, 2016 10:56 pm

Re: Script on ramdisk, advice?

Post by Wolfgan »

Fourdee wrote:
Wolfgan wrote:Hi,
I integrated a python script to read ambient temperature and humidity and display it via RpiMonitor (see http://rpi-experiences.blogspot.com/201 ... idity.html).

As the script executes every 2', I want it to run from a tmpfs ramdisk location to improve system performance and SD wear. I was thinking cron running it from /run , but I wonder what's the best strategy to copy the .py script in there at boot time.
Any suggestions / best practices? Thx, Wolf

PS: BTW, the script produces a txt file to be parsed by RpiMonitor, I pushed it to /var as this is also a tmpfs location.

Code: Select all

/etc/rc.local
Its the last script to run at the end of boot. So cp the python script from there.

How is the python script started? Might need to run the cp earlier.
Thanks Fourdee. The script is run via cron every 2' (crontab entry). I don't mind if the first run fails due the script not copied yet, so I'll try this approach. Thx again!
Post Reply