- Add apache to list of users that can send mail as others without a
[myplc.git] / plc.d / mail
1 #!/bin/bash
2 #
3 # priority: 250
4 #
5 # Start local mail server.
6 #
7 # Mark Huang <mlhuang@cs.princeton.edu>
8 # Copyright (C) 2006 The Trustees of Princeton University
9 #
10 # $Id: mail,v 1.3 2006/06/23 20:29:22 mlhuang Exp $
11 #
12
13 # Source function library and configuration
14 . /etc/plc.d/functions
15 . /etc/planetlab/plc_config
16
17 # Be verbose
18 set -x
19
20 case "$1" in
21     start)
22         if [ "$PLC_MAIL_ENABLED" != "1" ] ; then
23             exit 0
24         fi
25
26         MESSAGE=$"Starting mail server"
27         dialog "$MESSAGE"
28
29         # Add apache to list of users that can send mail as others
30         # without a warning, so that the API can send out mail.
31         echo "apache" >/etc/mail/trusted-users
32
33         service sendmail start
34         check
35
36         result "$MESSAGE"
37         ;;
38
39     stop)
40         MESSAGE=$"Stopping mail server"
41         dialog "$MESSAGE"
42
43         service sendmail stop
44         check
45
46         result "$MESSAGE"
47         ;;
48 esac
49
50 exit $ERRORS