ansitest/proxmox/BKPDEST.mrg

44 lines
1.7 KiB
Plaintext
Raw Normal View History

2024-05-22 09:56:29 -06:00
# bash - this is defining where backup tars, fsarchive, etc will be stored - can be local, sshfs, CIFS, NFS but must be R/W
# can be overridden b4 sourcing (set bkpdest var before sourcing this and you will still get the mount functionality)
2024-05-20 13:35:15 -06:00
2024-05-30 10:15:38 -06:00
echo "Thank you for using kneutron scripts. If you appreciate them and wish to send some support, please visit:"
echo " https://ko-fi.com/kingneutron "
2024-05-20 13:35:15 -06:00
# NOTE this script should be in /root/bin/boojum and be chmod +x
# it is sourced / used by several backup scripts
2024-05-22 09:56:29 -06:00
# you can have it live elsewhere (like /root) for convenience and soft-symlink to it if needed
2024-05-20 13:35:15 -06:00
# but the scripts are checking for it in /root/bin/boojum
2024-02-19 11:07:45 -07:00
2024-05-22 09:56:29 -06:00
# e.g.
# mkdir -pv /root/bin/boojum
# ln -sfn /root/BKPDEST.mrg /root/bin/boojum/
## and save BKPDEST in /root
## thus the bkpdest will be in /root for convenience, but still pointed to by the soft symlink in the usual location
## that the scripts expect
# xxx TODO EDITME - this is where your backups will be stored - NEEDS TO BE ON A SEPARATE DISK FROM ROOT!
2024-02-19 11:07:45 -07:00
#[ "$bkpdest" = "" ] && export bkpdest=/mnt/imac5
[ "$bkpdest" = "" ] && export bkpdest=/mnt/seatera4-xfs
2024-05-22 09:56:29 -06:00
[ $(echo $bkpdest |grep -c "/mnt/") -gt 0 ] && mount $bkpdest # mount if not ZFS - needs to be properly defined in /etc/fstab
[ $(echo $bkpdest |grep -c "/media/") -gt 0 ] && mount $bkpdest # mount if not ZFS
2024-02-19 11:07:45 -07:00
# from failexit.mrg
function failexit () {
echo '! Something failed! Code: '"$1 $2" # code # (and optional description)
exit $1
}
2024-05-22 09:56:29 -06:00
[ -e "$bkpdest/NOTHERE" ] && failexit 99 "$bkpdest NOTHERE detected -- NOT MOUNTED"
2024-02-19 11:07:45 -07:00
# "If" checking for NOTHERE file...
2024-05-22 09:56:29 -06:00
chkmount=$(df |grep -c $bkpdest)
2024-02-19 11:07:45 -07:00
[ $chkmount -gt 0 ] || failexit 99 "$bkpdest NOT MOUNTED"
# NOTE code 199 is generally could not cd to dir
2024-05-20 13:35:15 -06:00
export myhn=$(hostname)