only email if file exists

This commit is contained in:
kapeller
2014-05-22 07:22:35 +00:00
parent 81670219c5
commit 975226280d
+4 -2
View File
@@ -5,7 +5,7 @@
# a configuration file for the shellbox service.
# Create/update /etc/shellbox.d/<port>.conf files
#
# $Id: shellbox_from_db,v 1.2 2014/05/21 11:17:31 kapeller Exp $
# $Id: shellbox_from_db,v 1.3 2014/05/22 07:22:35 kapeller Exp $
# $Source: /cvs/G/EPICS/App/scripts/shellbox_from_db,v $
###############################################################################
#
@@ -66,7 +66,9 @@ if (wget -qO $tmpfile https://inventory.psi.ch/soap/softioc_info.aspx?host=$host
echo "### EOF" >> $new_file
if (! cmp -s $new_file $old_file); then
subject="SoftIOC #$port on $hostname has changed"
diff -u $new_file $old_file | mail -s "$subject" $email
if [ -e $old_file ]; then
diff -u $new_file $old_file | mail -s "$subject" $email
fi
cp $new_file $old_file
fi
fi