X-Git-Url: http://git.onelab.eu/?p=myplc.git;a=blobdiff_plain;f=plc.d%2Fmail;h=2471d65679989627bb342997a474c84293b8cc78;hp=158562202dbc092b5a19f5e90132640d61d47a1f;hb=ff06429772867a55fa0e2bed31306392c67a4405;hpb=720b8433a647a6a1fb6f4fc2c161786c77104e1c diff --git a/plc.d/mail b/plc.d/mail index 1585622..2471d65 100755 --- a/plc.d/mail +++ b/plc.d/mail @@ -9,43 +9,45 @@ # # Source function library and configuration -. /etc/plc.d/functions -. /etc/planetlab/plc_config +source /etc/plc.d/functions +source /etc/planetlab/plc_config # Be verbose set -x +echo '$1' = $1 + case "$1" in start) - if [ "$PLC_MAIL_ENABLED" != "1" ] ; then - exit 0 - fi + if [ "$PLC_MAIL_ENABLED" != "1" ] ; then + exit 0 + fi - MESSAGE=$"Starting mail server" - dialog "$MESSAGE" + MESSAGE=$"Starting mail server" + dialog "$MESSAGE" - # Add apache to list of users that can send mail as others - # without a warning, so that the API can send out mail. - count=$(grep ^apache /etc/mail/trusted-users|wc -l) - if [ $count -eq 0 ] ; then - echo "apache" >>/etc/mail/trusted-users - fi + # Add apache to list of users that can send mail as others + # without a warning, so that the API can send out mail. + count=$(grep ^apache /etc/mail/trusted-users|wc -l) + if [ $count -eq 0 ] ; then + echo "apache" >>/etc/mail/trusted-users + fi - (exec 3>&- 4>&- ; service sendmail start) - check + (exec 3>&- 4>&- ; systemctl start sendmail) + check - result "$MESSAGE" - ;; + result "$MESSAGE" + ;; stop) - MESSAGE=$"Stopping mail server" - dialog "$MESSAGE" + MESSAGE=$"Stopping mail server" + dialog "$MESSAGE" - service sendmail stop - check + systemctl stop sendmail + check - result "$MESSAGE" - ;; + result "$MESSAGE" + ;; esac exit $ERRORS