Avatar
mausmalone
12ca8af2055c12572177f9f719e2b3b8e4ad34281d64d0d3b8da32d8dae28be4
Old school jack-of-all-trades webmaster, but I mostly talk about old video games and computing.

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.

nostr:npub1wstchnnatqhe4ua983uhsn7k0mlvxlrdl8nfjledgr6ez7hcppdspcez75 Since I would be mounting and unmounting I'm pretty sure I could just pick the mount point. The directory names would always be consistent.

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)