summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/postfix/files/postfix
diff options
context:
space:
mode:
Diffstat (limited to 'meta-networking/recipes-daemons/postfix/files/postfix')
-rwxr-xr-xmeta-networking/recipes-daemons/postfix/files/postfix85
1 files changed, 85 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/postfix/files/postfix b/meta-networking/recipes-daemons/postfix/files/postfix
new file mode 100755
index 000000000..7bcc81625
--- /dev/null
+++ b/meta-networking/recipes-daemons/postfix/files/postfix
@@ -0,0 +1,85 @@
1#!/bin/sh
2
3success() {
4 echo " Successful"
5 exit 0
6}
7
8fail() {
9 echo " Failed"
10 exit 1
11
12}
13
14check_return () {
15 local ret="$1"
16
17 if [ "$ret" = "0" ]; then
18 success
19 else
20 fail
21 fi
22}
23
24PIDFile=/var/spool/postfix/pid/master.pid
25case "$1" in
26
27 start)
28 echo -n "Starting Postfix..."
29 if [ ! -e /etc/aliases.db ]; then
30 # The alias database is necessary for postfix to work correctly.
31 echo "Creating aliases database ..."
32 newaliases
33 fi
34 if ! postfix status >/dev/null 2>&1; then
35 postfix start
36 check_return $?
37 else
38 success
39 fi
40 ;;
41
42 stop)
43 echo -n "Stopping Postfix..."
44 if postfix status >/dev/null 2>&1; then
45 postfix stop
46 check_return $?
47 else
48 success
49 fi
50 ;;
51
52 reload)
53 echo -n "Reloading Postfix..."
54 if postfix status >/dev/null 2>&1; then
55 postfix reload
56 check_return $?
57 else
58 postfix start
59 check_return $?
60 fi
61 ;;
62
63 restart)
64 $0 stop
65 sleep 1
66 $0 start
67 ;;
68
69 status)
70 if postfix status >/dev/null 2>&1; then
71 pid=`sed -e 's/\s//g' $PIDFile`
72 echo "The Postfix mail system is running (PID: $pid)"
73 exit 0
74 else
75 echo "The Postfix mail system is not running"
76 exit 1
77 fi
78 ;;
79
80 *)
81 echo "Usage: $0 {start|stop|status|reload|restart}"
82 exit 1
83 ;;
84esac
85