Setting up cron job

SYSTEM INFORMATION
Ubuntu 22.04
Webmin version 2.013
I have created a cron job back up as follows-
innobackupex --user=root --password=accession /media/usb0/Backup/mysql && eject /media/usb0.
This works ok as long as the external drive USB0 is connected . If the drive is not connected the backup is written to my operating system drive and is filling it up.
I found a possible solution on the inertnet as follows
if ! mount grep -q “/media/backups”; then
  echo "/media/backups not mounted"
  exit 1

fi

However I do not know how to incorporate this into the cron job . Help would be appreciated
Please note that there is a pipe symbol between mount and grep but this editor does not seem ro like it.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.