smart groups that check for mounted volumes

kadams
Contributor

Is there a way to check for a mounted volume? If its not mounted, proceed to mount it?

I have a script that connects to synology NAS and it mounts a sparsebundle to /Volumes Time machine then sets that sparsebundle as a backup destination.

I noticed that sometimes i get an error that says the backup will start when the disk is ready.

I have to removed the disk as a time machine back and rerun the script.

Maybe theres a way to check if the disk is mounted and if it isn't remount it? and startbackup again.

6 REPLIES 6

ryan_ball
Valued Contributor

Smart groups are only accurate at the time of a recon. So If any amount of time has passed since the recon, the smart group results would be completely off as far as this is concerned.

Your script could be modified to look for the existence of the volume you are intending to mount, if it is there, unmount it, then mount afterward.

jared_f
Valued Contributor

Why not cache the script on each machine and then run it at login, network state change, and check-in. You could add something at the beginning of the scirpt to only mount if the drive is not already present.

kadams
Contributor

@jared_f because for some reason the drive gets unmounted at some point. I need something that will re mount the drive when jamf detects its unmounted. Im not exactly sure what causes the unmounting. I do have the script stored on select machines. I was going to have a script that runs it if the mount isn't present. I have a script that mounts the NAS Shared folder to a directory. then it mounts the sparsebundle in that folder to /Volumes. After that it uses that sparsebundle as a time machine backup destination. All of this now works. Sometime disconnection seems to happen. I want to be able to remount the that drive and use it as a backup destination again.

kadams
Contributor

@ryan.ball We have our machines check in every 15 minutes i think.

ShaunRMiller83
Contributor III

You might want to consider creating a launch dameon that can run every x minutes.

Then the script the launch daemon runs could have logic to check if the volume is mounted and if it isn't mount then it could mount the volume.

Then it's simply packaging it up with JAMF and deploy it to your systems after sufficent testing of course.

ryan_ball
Valued Contributor

@kadams Smart Groups populate based on inventory update, that is a different frequency than check-in. By default they update inventory once a week.