Listing 1. DATA Directory Back-up
#!/bin/sh
# This batch file backs up the data from SHARE
# -------------SCRIPT VARIABLES---------------
SHARE="//higgens/d_drive";
DATADIR="DATA";
USERNAME="notneeded"
PASSWD="mjdomo";
BACKUPFILE="higgens_data.zip";
BACKUPDRIVE="/dev/hdc1";
BACKUPMP="/mnt/backups/";
SMBMP="/mnt/smb/";
# ---------------------------------------------
export PASSWD;
echo 'go';
smbumount $SMBMP;
smbmount $SHARE $SMBMP -N -n$USERNAME;
if (ls $SMBMP$DATADIR) then
echo "Backing up $SHARE";
mount -t vfat $BACKUPDRIVE $BACKUPMP;
cd $SMBMP;
zip -r -u -v $BACKUPMP$BACKUPFILE $DATADIR;
cd /;
umount $BACKUPDRIVE;
fi;
smbumount $SMBMP;
Copyright © 1994 - 2018 Linux Journal. All rights reserved.