Ok, here is my script so far:
Admsnap is the EMC Clarion utility that creates snapshots from the the SAN. As you can see I umount, deactivate, and stop the previous snapshot (if any, if not is gives an error but continues fine). Then create a new one and create the appropriate symlink so Samba will use it for the Shadow Copy service.
My only problem is that I need to also delete the previous symlink. I have 2 ideas for how this would be possible:
1. Since this will be run from cron daily, assume the previous $SHADOWNAME is exactly one day ago. However this does not account for if I happen to decide to run the script manually, and also what if the script is off by a second or more from the previous day.
2. Have something like "Session1: $SHADOWNAME" written to a text file. Every time the script is run it reads the $SHADOWNAME from the text file and deletes that symlink, then replaces that with the new $SHADOWNAME. The problem with this is, I have no idea how to do this.
Is there a better way, or could someone help me set up this idea?
#!/bin/bash
# Creating Shadow Copies
# remove the old shadow copy
umount -f /dev/sdc1
/usr/admsnap/admsnap deactivate -s Session1
/usr/admsnap/admsnap stop -s Session1
# create a new shadow copy
SHADOWNAME=`date -u +%Y.%m.%d-%H.%M.%S`
/usr/admsnap/admsnap flush -o /dev/sdb
/usr/admsnap/admsnap start -s Session1 -o /dev/sdb
/usr/admsnap/admsnap activate -s Session1 -o /dev/sdc
mount /dev/sdc1 /export/snaps/Snap1 -o ro,acl,user_xattr
ln -s /export/snaps/Snap1/share /export/share/@GMT-$SHADOWNAME
Admsnap is the EMC Clarion utility that creates snapshots from the the SAN. As you can see I umount, deactivate, and stop the previous snapshot (if any, if not is gives an error but continues fine). Then create a new one and create the appropriate symlink so Samba will use it for the Shadow Copy service.
My only problem is that I need to also delete the previous symlink. I have 2 ideas for how this would be possible:
1. Since this will be run from cron daily, assume the previous $SHADOWNAME is exactly one day ago. However this does not account for if I happen to decide to run the script manually, and also what if the script is off by a second or more from the previous day.
2. Have something like "Session1: $SHADOWNAME" written to a text file. Every time the script is run it reads the $SHADOWNAME from the text file and deletes that symlink, then replaces that with the new $SHADOWNAME. The problem with this is, I have no idea how to do this.
Is there a better way, or could someone help me set up this idea?
