problem with running mdconfig from shell script
    Kris Kennaway 
    kris at FreeBSD.org
       
    Tue Sep  4 01:52:51 PDT 2007
    
    
  
Maikel Lambregts wrote:
> Hi,
> 
> I want to make automatic backup of my MySQL by using FreeBSD snapshots. All
> works fine when I run the commands from my Putty, but when I run them from a
> shell script the 2th command (mdconfig) gives an error. 
> 
> These are the comments to make the backup, that work fine from Putty =>
> 
> ========================================
> /usr/local/bin/mysql -u??? -p??? -e "FLUSH TABLES WITH READ LOCK;system
> mksnap_ffs /usr /usr/snapshot;UNLOCK TABLES;"
> mdconfig -a -t vnode -f /usr/snapshot -u 4
> mount -r /dev/md4 /mnt
> tar -cvjf /usr/home/mysqlsnapshot.tar.bz2 /mnt/home/databases
> umount /mnt
> mdconfig -d -u 4
> rm -f /usr/snapshot
> ========================================
> 
> I get this error when I run the above from a .sh script =>
> 
> myserver# ./mysqlsnapshot.sh
> : not found
> mdconfig: bad unit: 4
> : No such file or directory
This is not a mdconfig question, rather a basic shell scripting 
question.  Use "sh -x" to run the script to see what it is doing wrong.
One problem is that you are missing lots of error handling.  If any of 
those commands fails then subsequent commands may misbehave.
Kris
    
    
More information about the freebsd-questions
mailing list