You have posted two scripts.
I am not sure if this is what you want, but this is how I'd do it:
Code:
#!/bin/bash
if [[ -n `mount | grep rtlogs` ]]; then
echo "mounted"
if [[ $1 == "act" ]]; then
echo insert_your_umount_command_and_remove_this_echo || echo "Failed to unmount!!!"
fi
exit 0
else
echo "not mounted"
if [[ $1 == "act" ]]; then
echo insert_your_mount_command_and_remove_this_echo || echo "Failed to mount!!!"
fi
fi
If called without parameters, this script will only show you the mount status. If called with the
act parameter, it would be able to (u)mount as well.