Remote script for images and src/images upload
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
#!/bin/sh
# HOME_S BASE BASES_S and ADDRESS
# will be replaced by the appropriate values by sed
DATE=$(date +"%Y-%m-%d-%T")
if [ -e ./images.tmp ] ; then
FILES="images"
rm -f ./images.tmp
fi
if [ -e ./src.tmp ] ; then
FILES="src"
rm -f ./src.tmp
fi
echo "Error log of update for $FILES of base: BASE" #### > LOGS/remote.log
echo "`date`"
# Save current version then move new version
if [ -d BASES_S/$FILES/BASE ] ; then # do it only if folder exists
mv BASES_S/$FILES/BASE BASES_S/$FILES/BASE-$DATE #### 2>> LOGS/remote.log
fi
mv HOME_S/BASE BASES_S/$FILES #### 2>> LOGS/remote.log
chown -R WUSR BASES_S/$FILES/BASE #### 2>> LOGS/remote.log
chgrp -R WGRP BASES_S/$FILES/BASE #### 2>> LOGS/remote.log
cd BASES_S/$FILES/BASE
rm -f ./._* #### &>> LOGS/remote.log
if [ "$FILES" = "src" ]
then
cd BASES_S/src/BASE/images #### 2>> LOGS/remote.log
rm -f ./._* #### 2>> LOGS/remote.log
fi
rm -f HOME_S/remote.* HOME_S/BASE-files.tar #### 2>> LOGS/remote.log
#/usr/bin/mail -s 'Update error log' 'ADDRESS' < LOGS/remote.log