Answer the question
In order to leave comments, you need to log in
How to compare dates of two files?
Need a script to update .gzip files on the server.
There is an array with filenames:
FILES_SITE=(
style.css
scripts.js
sprites.svg
)
for i in ${FILES_SITE[@]};do
find /var/www/ -type f -name ${i} | while read -r path; do
// gzip -c -9 "$i" > "$i.gz";
// echo $path
done
done
Answer the question
In order to leave comments, you need to log in
Well, I usually take the date of the file, convert it to UTC, then also take the date of the second file - and stupidly compare
. Here is a piece of script that I use to update the CRL on the server
# Take last modification date of newly downloaded CRL file as UTC time
_newcrl=`date -r $storedir/$crlfile +%s`
# Take last modification date of stored CRL file as UTC time
_oldcrl=`date -r $cadir/$crlfile +%s`
# When CRL file is missed, install fake file with modification date Jan 1 1970 00:00
if [ ! -f $cadir/$crlfile ]; then
touch -t 197001010000 $cadir/$crlfile
fi
# If file on CA store is never than file in their own store - we had have
# publish new CRL and must upload it to server
if [ $_newcrl -gt $_oldcrl ]; then
[тут мы что-то делаем]
fi
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question