diff --git a/tomcat-instance/files/tomcat.service b/tomcat-instance/files/tomcat.service index c54eb4be..0a5a22d9 100644 --- a/tomcat-instance/files/tomcat.service +++ b/tomcat-instance/files/tomcat.service @@ -9,7 +9,6 @@ EnvironmentFile=%h/conf/env UMask=0002 ExecStart=/usr/share/tomcat7/bin/startup.sh ExecStop=/usr/share/tomcat7/bin/shutdown.sh -ExecStopPost=/bin/sh -c date | /usr/bin/mail -s "%H/%u : Shutdown instance" %u Type=forking [Install] diff --git a/tomcat-instance/templates/bin/shutdown.sh b/tomcat-instance/templates/bin/shutdown.sh index 95544a5d..3daf3be6 100755 --- a/tomcat-instance/templates/bin/shutdown.sh +++ b/tomcat-instance/templates/bin/shutdown.sh @@ -2,3 +2,6 @@ # alias for compatibility sudo -iu {{ tomcat_instance_name }} systemctl --user stop tomcat +{% if tomcat_instance_mail is defined %} +/bin/sh -c date | /usr/bin/mail -s {{ inventory_hostname }}/{{ tomcat_instance_name }} : Shutdown instance {{ tomcat_instance_mail }} +{% endif %}