/var Directory Handling


Hitnrun

Member
Joined
Mar 1, 2008
Messages
427
I am planning to port some applications to the Pandora (at start, lighttpd/php/mysql so I can dev on it!), but thinking ahead, I think the main problem I will have is the output files in /var (/var/mysql databases, /var/log log files).

I looked around and did not found any documentation on this, on the pandora the path "/var/volatile" seems to be mounted somewhere else but only it, what should I do about programs that want to write to /var? Where does it points on the pandora, is it safe to write to?

As I know these applications can't be running all the time I plan to make a start/stop script, so if I remove the sd card it does not go crazy.

Is there a "best practices" programming guide for the Pandora?
 
Maybe use aufs so the app specific /var/foo is redirected to sd in your start/stop? Or boot from sd :). Could use symlinks as well

Jeffphone
 
Hitnrun said:
I am planning to port some applications to the Pandora (at start, lighttpd/php/mysql so I can dev on it!), but thinking ahead, I think the main problem I will have is the output files in /var (/var/mysql databases, /var/log log files).

I looked around and did not found any documentation on this, on the pandora the path "/var/volatile" seems to be mounted somewhere else but only it, what should I do about programs that want to write to /var? Where does it points on the pandora, is it safe to write to?

As I know these applications can't be running all the time I plan to make a start/stop script, so if I remove the sd card it does not go crazy.

Is there a "best practices" programming guide for the Pandora?
/var/log is "safe" as it's a symlink inside /var/volatile which iself is mounted directly from memory. (yes that does mean that logs are lost on reboot but who cares ?)
Your nand won't like to host a mysql database though (/var/mysql). You (and we as users) want to have this stored on the SDcard, but i'm sure there is a way to set this the the appdata of your app in the mysql config files.

IMHO it's a weird idea to have an app depending on a local website, and I can't see how you'll manage to package this in a pnd.
 
Last edited by a moderator:
httpd as a pnd woudl work, just nutty :) Or have the Apache conf allow for /media/*/pandora/appdata/htdocs/* sites, or something. Should not be too hard, just a little odd :)

jeff
 
skeezix said:
httpd as a pnd woudl work, just nutty :) Or have the Apache conf allow for /media/*/pandora/appdata/htdocs/* sites, or something. Should not be too hard, just a little odd :)

jeff
How would you make pnd_run.sh to not try to umount the filesystems once apachectl has started httpd ? If my memory is right, this script once the EXEC command have return (wich apachectl should do fast) will try to find any process named like the exec command before umount.

You can go, with a script that will wait for the httpd process as exec command, but then how would you stop ? Use an other icon defined in the pxml to launch a script that will send sigint to all httpd process ? sound hackish to me.
Now think about mysqld and the status of its data...
 
Last edited by a moderator:
If a file is in use within a file system, unmount will always fail. ( It'll complain and tell you to use lsof or fuser to find out the naughty process locking the file system and to clean it up yourself. )

Just means you need to provide your own means of safely cleaning up if you don't want to essentially lock the SD card and mount points.
 
seb - more to point, just have a wrapper script that does the running, and then hangs arond until httpd has been stopped; a little while/sleep/test loop so it checks every 30s or something, should be okay. (ie: so that pnd_run.sh is waiting around indefinately, and when the httpd finally does get shut down, it does the unmount/etc.)

Another thing you could do is just use pnd_run.sh yourself from start/stop scripts - you can tell pnd_run.sh to do a mount-only, or an unmont-only, without the exec-and-wait-around bit; so your start script coudl be 'mount' and 'run', and then your stop script could be 'kill' and 'unmount'.

Check out the pnd_run.sh command line.

jeff
 
Back
Top