Build script: include TZ in timestamps, remove duplication

This commit is contained in:
Steve Purcell 2013-04-17 12:47:12 +01:00
parent 7c8d821559
commit 8f488bbab2

View file

@ -1,10 +1,13 @@
#!/bin/bash #!/bin/bash
function timestamp {
date "+%Y%m%d %H:%M %Z"
}
function melpa { function melpa {
timestamp
date "+%Y%m%d %H:%M" timestamp > $HOME/www/status.txt
date "+%Y%m%d %H:%M" > $HOME/www/status.txt
echo "building..." >> $HOME/www/status.txt echo "building..." >> $HOME/www/status.txt
MELPADIR=${MELPADIR:-$HOME/melpa} MELPADIR=${MELPADIR:-$HOME/melpa}
@ -41,13 +44,13 @@ function melpa {
/usr/sbin/logrotate -s $HOME/log/logrotate.state $HOME/log/melpa.logrotate 1>> ${STDOUT} 2>> ${STDERR} /usr/sbin/logrotate -s $HOME/log/logrotate.state $HOME/log/melpa.logrotate 1>> ${STDOUT} 2>> ${STDERR}
EMAIL=`mktemp` EMAIL=`mktemp`
echo "Subject: Melpa status `date '+%Y-%m-%d %H:%M:%S'`" > ${EMAIL} echo "Subject: Melpa status `timestamp`" > ${EMAIL}
cat ${MELPASTDOUT} ${STDOUT} ${ENVLOG} ${STDERR} >> ${EMAIL} cat ${MELPASTDOUT} ${STDOUT} ${ENVLOG} ${STDERR} >> ${EMAIL}
/usr/sbin/sendmail dcurtis@milkbox.net < ${EMAIL} /usr/sbin/sendmail dcurtis@milkbox.net < ${EMAIL}
cat ${ENVLOG} ${STDERR} ${STDOUT} | tee $WEBROOT/lastrun.txt cat ${ENVLOG} ${STDERR} ${STDOUT} | tee $WEBROOT/lastrun.txt
date "+%Y%m%d %H:%M" > $HOME/www/status.txt timestamp > $HOME/www/status.txt
echo "completed" >> $HOME/www/status.txt echo "completed" >> $HOME/www/status.txt
} }