Hey I have a question for the #linux community. For background I'm trying to set up a nightly backup to NAS via cron, bash and rsync. But because I'm doing this from a laptop that's not always on this network, after I mount the drive I need to /check/ to see if it's mounted before I try to copy files.

Does anybody know how to do that check? Or should I just let rsync run and trust that it'll fail gracefully? (the NAS is presented as an SMB share if that helps)

Reply to this note

Please Login to reply.

Discussion

nostr:npub1klw906w2f0lwfp7fle9al80fe77n7nmgnlyfh6s4he8gvn09t9dql0jmy2 is it always the same drive indicator? i.e. /dev/sdb or whatever? If so, you could use an if statement to see if that directory exists.

If the drive letters change, then you could use fstab to always mount it in the same directory. Then use an if statement to check to see if that directory has contents.