I _think_ that maybe if you have a tuple of 1, it gets "unwrapped" in
some way to be just a singleton - or at least I was encountering a
bug along those lines...
(('/mnt/tmp', 'mount /mnt/tmp'))[0] == '/'
^ this is where my big was occuring, I think
It also could've been an issue with the printing - no idea.
Changing from a tuple to a list seems to be better
Remount Checker
This is a very simple program to check if a particular folder is a mounted folder or not. If it's not, run the mount command - simple!
mount_points
You need a mount_points.py file. The example_mount_points.py provides an example format (it's a touple - first element is the folder to check, second element is the command to run).
mount command
You'll need to make sure that the cronuser (can't think of the exact correct term - the user that cron pretends(?) to be when runnign the command??) is able to actually run the mount command. There are 2 simple options that I can see:
- Use
sudo crontab -eand makerootuse run the command, or - Make your user able to run the mount command. I'm sorry I don't know 100%, but I think that means adding
userto the mount options infstab.
crontab
The idea is you should run this is crontab every X minutes - 5 seems to work fine for me. An example crontab is:
*/5 * * * * /usr/bin/python /home/<USER>/code/remount_checker/remount.py
Replace (and the rest) with the location of remount