• Checking for a mount in a shell script (Was: Re: Preparing for Debian 1

    From Andy Smith@21:1/5 to Default User on Sun May 18 19:20:01 2025
    Hi,

    On Sun, May 18, 2025 at 12:47:25PM -0400, Default User wrote:
    Since I know almost no shell scripting, the rsync usb drive Aá
    to usb drive B copy is done with a simple bash script consisting
    only of the rsync backup command, with options and parameters, but
    without any code to verify that usb drive B is attached.

    I really should learn more shell scripting. That is something
    else I will get to "Real Soon Now".
    :)

    If your backup script is a bash script then all you need do is put
    something like:

    if ! findmnt /mnt/usb-drive-b; then
    echo "Mount USB drive B before running this!" >&2
    exit 1
    fi

    near the top of your script, assuming that /mnt/usb-drive-b is where you
    expect that to be mounted.

    You can do fancier checks to make sure that the thing mounted there is
    really the correct thing, but that will do for starters.

    Thanks,
    Andy

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)