Best way to check the status of a SSHFS mount via php?

1.7k views Asked by At

We have a few sshfs based mounts.

We also use pingdom to monitor our service.

We would like to create a custom pingdom handler (php based, accessed via our webserver) to test the status of these mounts.

What is the best way to test the status of these mounts via php?

We were thinking of doing a simple is_file / is_dir but the only downside with this method is that these sshfs mounts all differ from each other (differ as in, not all root (/) mounts) so each mount would have to test for a different file / dir.

I supposed another method would be to test fstab and parse the status out of there?

Any other ideas?

Thanks!

1

There are 1 answers

0
Mariano ArgaƱaraz On

You should mount he remote directory with the user and group you need (it may differ in development), and add the allow_other option:

sshfs -o uid={USER_ID},gid={GROUP_ID},allow_other  {REMOTE_USER}@{SERVER_IP}:/var/www/html/images/adjuntos/imagen media/