I've a bunch of repository dumps that I need to include in my shell script to restore from the dump, but first I need to create the repositories first. How do I extract the names of the repository and removing the *.dump for use of the following line?
bash-3.00$ ls
andromeda.dump
alias.dump
broken.dump
calibre.dump
...
and I need to execute this commands
bash-3.00$ svnadmin create andromeda
bash-3.00$ svnadmin load andromeda </opt/vendor/svn/backups/andromeda.dump &
and repeat this for a few hundred repositories.
My guess is I need to use sed or awk to transform and omit the ".dump" first?
pludi
August 30, 2010, 5:30am
2
Not tested:
for dump in *.dump
do
repo=$( basename $dump '.dump' )
echo svnadmin create $repo
( echo "svnadmin load $repo < /opt/vendor/svn/backups/$dump" && echo "$(date) $repo restore done" ) &
done
If the commands echoed look ok, un-echo the svnadmin commands.
1 Like
pludi:
Not tested:
for dump in *.dump
do
repo=$( basename $dump )
echo svnadmin create $repo
( echo "svnadmin load $repo < /opt/vendor/svn/backups/$dump" && echo "$(date) $repo restore done" ) &
done
If the commands echoed look ok, un-echo the svnadmin commands.
I tested the script and it doesn't omit off the *.dump.
pludi
August 31, 2010, 3:10am
4
Ah, yes, missed something on the basename line. Fixed in the above post.
1 Like
Perfect! Exactly what I needed! Thanks!