I have the following shell script which writes volumes in a find
command to a file, and loads that file into a mysql database:
# find all the paths and print them to a file
sudo find $FULFILLMENT/ > $FILE
sudo find $ARCH1/ >> $FILE
sudo find $ARCH2/ >> $FILE
sudo find $MASTERING/ >> $FILE
# load the file into the mysql database, `files`, table `path`
/usr/local/bin/mysql -u root files -e "TRUNCATE path"
/usr/local/bin/mysql -u root files -e "LOAD DATA INFILE '/tmp/files.txt' INTO TABLE path"
TRUNCATE
is to be used to delete all the old entries before adding the new. However, if any of the find
commands don't work (for example, if the volume isn't accessible), I want it to skip on the two mysql
commands. How would I modify the above script to do this?