Jump to content

Connect to a directory on a NAS server


straygrey

Recommended Posts

Is there a way for me to connect to a directory on a NAS server running a windows share from PHP.

I can connect from the command line using mount, but I want the connect within my PHP script.

Can this be done & if so how?

Link to comment
Share on other sites

This is the type of thing where it would probably just be better to do this in a bash script, if the idea is that you want to mount the shared drive, test for the existence of a file, email if it's not there, and then unmount it.

Link to comment
Share on other sites

Well there's mount and umount, which you should be able to test from the shell.  Add those to your script, and you can test for the existence of a file with:

 

#!/bin/bash
#mount share here
if [ ! -f /mountdir/backupfilename ]
then
    mail -s "Backup file missing" you@domain.com
fi
#umount here

 

That's about all there is to it.  Stick in a cron for this at the appropriate time, and you should be covered.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.