mirror of
https://github.com/thead-yocto-mirror/meta-openembedded
synced 2026-09-18 21:21:58 +02:00
Postfix is Wietse Venema's mail server that started life at IBM research as an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and secure. The outside has a definite Sendmail-ish flavor, but the inside is completely different. Signed-off-by: Jackie Huang <jackie.huang@windriver.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
86 lines
1.6 KiB
Bash
Executable File
86 lines
1.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
success() {
|
|
echo " Successful"
|
|
exit 0
|
|
}
|
|
|
|
fail() {
|
|
echo " Failed"
|
|
exit 1
|
|
|
|
}
|
|
|
|
check_return () {
|
|
local ret="$1"
|
|
|
|
if [ "$ret" = "0" ]; then
|
|
success
|
|
else
|
|
fail
|
|
fi
|
|
}
|
|
|
|
PIDFile=/var/spool/postfix/pid/master.pid
|
|
case "$1" in
|
|
|
|
start)
|
|
echo -n "Starting Postfix..."
|
|
if [ ! -e /etc/aliases.db ]; then
|
|
# The alias database is necessary for postfix to work correctly.
|
|
echo "Creating aliases database ..."
|
|
newaliases
|
|
fi
|
|
if ! postfix status >/dev/null 2>&1; then
|
|
postfix start
|
|
check_return $?
|
|
else
|
|
success
|
|
fi
|
|
;;
|
|
|
|
stop)
|
|
echo -n "Stopping Postfix..."
|
|
if postfix status >/dev/null 2>&1; then
|
|
postfix stop
|
|
check_return $?
|
|
else
|
|
success
|
|
fi
|
|
;;
|
|
|
|
reload)
|
|
echo -n "Reloading Postfix..."
|
|
if postfix status >/dev/null 2>&1; then
|
|
postfix reload
|
|
check_return $?
|
|
else
|
|
postfix start
|
|
check_return $?
|
|
fi
|
|
;;
|
|
|
|
restart)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
|
|
status)
|
|
if postfix status >/dev/null 2>&1; then
|
|
pid=`sed -e 's/\s//g' $PIDFile`
|
|
echo "The Postfix mail system is running (PID: $pid)"
|
|
exit 0
|
|
else
|
|
echo "The Postfix mail system is not running"
|
|
exit 1
|
|
fi
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: $0 {start|stop|status|reload|restart}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|