Difference between revisions of "remote-files.sh"
From GeneWeb
(Remote-files.sh) |
m |
||
Line 1: | Line 1: | ||
− | {{DISPLAYTITLE: | + | {{DISPLAYTITLE:Remote-files.sh}} |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> |
Latest revision as of 11:52, 26 November 2016
#!/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