head	1.2;
access;
symbols
	perseant-exfatfs-base-20250801:1.2
	perseant-exfatfs-base-20240630:1.2
	cjep_sun2x:1.2.0.44
	cjep_sun2x-base:1.2
	cjep_staticlib_x-base1:1.2
	cjep_staticlib_x:1.2.0.42
	cjep_staticlib_x-base:1.2
	phil-wifi-20200421:1.2
	phil-wifi-20200411:1.2
	phil-wifi-20200406:1.2
	pgoyette-compat-merge-20190127:1.2
	pgoyette-compat-20190127:1.2
	pgoyette-compat-20190118:1.2
	pgoyette-compat-1226:1.2
	pgoyette-compat-1126:1.2
	pgoyette-compat-1020:1.2
	pgoyette-compat-0930:1.2
	pgoyette-compat-0906:1.2
	pgoyette-compat-0728:1.2
	pgoyette-compat-0625:1.2
	pgoyette-compat-0521:1.2
	pgoyette-compat-0502:1.2
	pgoyette-compat-0422:1.2
	pgoyette-compat-0415:1.2
	pgoyette-compat-0407:1.2
	pgoyette-compat-0330:1.2
	pgoyette-compat-0322:1.2
	pgoyette-compat-0315:1.2
	pgoyette-compat:1.2.0.40
	pgoyette-compat-base:1.2
	perseant-stdc-iso10646:1.2.0.38
	perseant-stdc-iso10646-base:1.2
	prg-localcount2-base3:1.2
	prg-localcount2-base2:1.2
	prg-localcount2-base1:1.2
	prg-localcount2:1.2.0.36
	prg-localcount2-base:1.2
	pgoyette-localcount-20170426:1.2
	bouyer-socketcan-base1:1.2
	pgoyette-localcount-20170320:1.2
	bouyer-socketcan:1.2.0.34
	bouyer-socketcan-base:1.2
	pgoyette-localcount-20170107:1.2
	pgoyette-localcount-20161104:1.2
	localcount-20160914:1.2
	pgoyette-localcount-20160806:1.2
	pgoyette-localcount-20160726:1.2
	pgoyette-localcount:1.2.0.32
	pgoyette-localcount-base:1.2
	netbsd-5-2-3-RELEASE:1.2
	netbsd-5-1-5-RELEASE:1.2
	yamt-pagecache-base9:1.2
	yamt-pagecache-tag8:1.2
	tls-earlyentropy:1.2.0.28
	tls-earlyentropy-base:1.2
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.2
	riastradh-drm2-base3:1.2
	netbsd-5-2-2-RELEASE:1.2
	netbsd-5-1-4-RELEASE:1.2
	netbsd-5-2-1-RELEASE:1.2
	netbsd-5-1-3-RELEASE:1.2
	agc-symver:1.2.0.30
	agc-symver-base:1.2
	tls-maxphys-base:1.2
	yamt-pagecache-base8:1.2
	netbsd-5-2:1.2.0.26
	yamt-pagecache-base7:1.2
	netbsd-5-2-RELEASE:1.2
	netbsd-5-2-RC1:1.2
	yamt-pagecache-base6:1.2
	yamt-pagecache-base5:1.2
	yamt-pagecache-base4:1.2
	netbsd-5-1-2-RELEASE:1.2
	netbsd-5-1-1-RELEASE:1.2
	yamt-pagecache-base3:1.2
	yamt-pagecache-base2:1.2
	yamt-pagecache:1.2.0.24
	yamt-pagecache-base:1.2
	bouyer-quota2-nbase:1.2
	bouyer-quota2:1.2.0.22
	bouyer-quota2-base:1.2
	matt-nb5-pq3:1.2.0.20
	matt-nb5-pq3-base:1.2
	netbsd-5-1:1.2.0.18
	netbsd-5-1-RELEASE:1.2
	netbsd-5-1-RC4:1.2
	netbsd-5-1-RC3:1.2
	netbsd-5-1-RC2:1.2
	netbsd-5-1-RC1:1.2
	netbsd-5-0-2-RELEASE:1.2
	netbsd-5-0-1-RELEASE:1.2
	jym-xensuspend-nbase:1.2
	netbsd-5-0:1.2.0.16
	netbsd-5-0-RELEASE:1.2
	netbsd-5-0-RC4:1.2
	netbsd-5-0-RC3:1.2
	netbsd-5-0-RC2:1.2
	jym-xensuspend:1.2.0.14
	jym-xensuspend-base:1.2
	netbsd-5-0-RC1:1.2
	netbsd-5:1.2.0.12
	netbsd-5-base:1.2
	mjf-devfs2:1.2.0.10
	mjf-devfs2-base:1.2
	yamt-pf42-base4:1.2
	yamt-pf42-base3:1.2
	hpcarm-cleanup-nbase:1.2
	yamt-pf42-base2:1.2
	yamt-pf42:1.2.0.8
	yamt-pf42-base:1.2
	keiichi-mipv6:1.2.0.6
	keiichi-mipv6-base:1.2
	cube-autoconf:1.2.0.4
	cube-autoconf-base:1.2
	hpcarm-cleanup:1.2.0.2
	hpcarm-cleanup-base:1.2
	netbsd-1-5-PATCH003:1.1.1.1
	PFIX-20010228-pl08:1.1.1.3
	netbsd-1-5-PATCH002:1.1.1.1
	PFIX-20010228-pl04:1.1.1.3
	netbsd-1-5-PATCH001:1.1.1.1
	PFIX-20010228-pl03:1.1.1.3
	PFIX-20010228-pl02:1.1.1.3
	PFIX-20010228-pl01:1.1.1.2
	PFIX-20010228:1.1.1.2
	PFIX-19991231-pl12:1.1.1.1
	netbsd-1-5-RELEASE:1.1.1.1
	netbsd-1-5-BETA2:1.1.1.1
	netbsd-1-5-BETA:1.1.1.1
	netbsd-1-5-ALPHA2:1.1.1.1
	netbsd-1-5:1.1.1.1.0.2
	netbsd-1-5-base:1.1.1.1
	PFIX-19991231-pl08:1.1.1.1
	PFIX-19991231-pl07:1.1.1.1
	PFIX-19991231-pl06:1.1.1.1
	VENEMA:1.1.1;
locks; strict;
comment	@# @;


1.2
date	2002.02.02.23.27.41;	author perry;	state dead;
branches;
next	1.1;

1.1
date	2000.04.30.18.52.35;	author perry;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	2000.04.30.18.52.35;	author perry;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	2001.03.13.17.45.29;	author itojun;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	2001.05.08.04.55.36;	author itojun;	state Exp;
branches;
next	;


desc
@@


1.2
log
@not part of release 1.1.2
@
text
@#!/bin/sh

#++
# NAME
#	postfix-script 1
# SUMMARY
#	execute Postfix administrative commands
# SYNOPSIS
#	\fBpostfix-script\fR \fIcommand\fR
# DESCRIPTION
#	The \fBfBpostfix-script\fR script executes Postfix administrative
#	commands in an environtment that is set up by the \fBpostfix\fR(1)
#	command.
# SEE ALSO
#	master(8) Postfix master program
#	postfix(1) Postfix administrative interface
# LICENSE
# .ad
# .fi
#	The Secure Mailer license must be distributed with this software.
# AUTHOR(S)
#	Wietse Venema
#	IBM T.J. Watson Research
#	P.O. Box 704
#	Yorktown Heights, NY 10598, USA
#--

# Avoid POSIX death due to SIGHUP when some parent process exits.

trap '' 1

case $daemon_directory in
"") echo This script must be run by the postfix command. 1>&2
    echo Do not run directly. 1>&2
    exit 1
esac

LOGGER="$command_directory/postlog -t postfix-script"
INFO="$LOGGER -p info"
WARN="$LOGGER -p warn"
ERROR="$LOGGER -p error"
FATAL="$LOGGER -p fatal"
PANIC="$LOGGER -p panic"

umask 022

#
# LINUX by default does not synchronously update directories -
# that's dangerous for mail.
#
if [ -f /usr/bin/chattr ]
then
	CHATTR="/usr/bin/chattr +S"
else
	CHATTR=:
fi

#
# Can't do much without these in place.
#
cd $command_directory || {
	$FATAL no Postfix command directory $command_directory!
	exit 1
}
cd $daemon_directory || {
	$FATAL no Postfix daemon directory $daemon_directory!
	exit 1
}
test -f master || {
	$FATAL no Postfix master program $daemon_directory/master!
	exit 1
}
cd $config_directory || {
	$FATAL no Postfix configuration directory $config_directory!
	exit 1
}
cd $queue_directory || {
	$FATAL no Postfix queue directory $queue_directory!
	exit 1
}

#
# Parse JCL
#
case $1 in

start_msg)

	echo "Start postfix"
	;;

stop_msg)

	echo "Stop postfix"
	;;

start)

	$daemon_directory/master -t 2>/dev/null || {
		$FATAL the Postfix mail system is already running
		exit 1
	}
	$config_directory/postfix-script check || {
		$FATAL Postfix integrity check failed!
		exit 1
	}
	$INFO starting the Postfix mail system
	$daemon_directory/master &
	;;

drain)

	$daemon_directory/master -t 2>/dev/null && {
		$FATAL the Postfix mail system is not running
		exit 1
	}
	$INFO stopping the Postfix mail system
	kill -9 `sed 1q pid/master.pid`
	;;

stop)

	$daemon_directory/master -t 2>/dev/null && {
		$FATAL the Postfix mail system is not running
		exit 1
	}
	$INFO stopping the Postfix mail system
	kill `sed 1q pid/master.pid`
	;;

abort)

	$daemon_directory/master -t 2>/dev/null && {
		$FATAL the Postfix mail system is not running
		exit 1
	}
	$INFO aborting the Postfix mail system
	kill `sed 1q pid/master.pid`
	;;

reload)

	$daemon_directory/master -t 2>/dev/null && {
		$FATAL the Postfix mail system is not running
		exit 1
	}
	$INFO refreshing the Postfix mail system
	kill -HUP `sed 1q pid/master.pid`
	;;

flush)

	cd $queue_directory || {
		$FATAL no Postfix queue directory $queue_directory!
		exit 1
	}
	$command_directory/postkick public qmgr IDFA
	;;

check)

	for dir in $daemon_directory $config_directory $queue_directory
	do
		ls -lLd $dir | (grep " root " >/dev/null ||
		    $WARN not owned by root: $dir)
	done

	find $daemon_directory/* $config_directory/* ! -user root \
		-exec $WARN not owned by root: {} \;

	find $daemon_directory/. $config_directory/. \
		\( -perm -020 -o -perm -002 \) \
		-exec $WARN group or other writable: {} \;

	find $queue_directory/* $config_directory/* -name '*core' \
		-exec $WARN core file: {} \; 2>/dev/null

	test -d maildrop || {
		$WARN creating missing Postfix maildrop directory
		mkdir maildrop || exit 1
		chmod 1733 maildrop
		chown $mail_owner maildrop
	}
	test -d pid || {
		$WARN creating missing Postfix pid directory
		mkdir pid || exit 1
		chmod 755 pid
		chown $mail_owner pid
	}
	for dir in incoming active bounce defer deferred saved corrupt; do
		test -d $dir || {
			$WARN creating missing Postfix $dir directory
			mkdir $dir || exit 1
			chmod 700 $dir; $CHATTR $dir
			chown $mail_owner $dir
		}
	done
	test -d public || {
		$WARN creating missing Postfix public directory
		mkdir public || exit 1
		chmod 755 public
		chown $mail_owner public
	}
	test -d private || {
		$WARN creating missing Postfix private directory
		mkdir private || exit 1
		chmod 700 private
		chown $mail_owner private
	}
	find `ls -d $queue_directory/* | \
	    egrep '/(incoming|active|defer|deferred|bounce|saved|corrupt|public|private)$'` \
	    ! \( -type p -o -type s \) ! -user $mail_owner \
		-exec $WARN not owned by $mail_owner: {} \;

	for dir in $queue_directory/maildrop
	do
		ls -lLd $dir | (grep " $mail_owner " >/dev/null ||
		    $WARN not owned by $mail_owner: $dir)
	done

	for dir in bin etc lib sbin usr
	do
		test -d $dir && find $dir -type f -print | while read path
		do
			cmp -s $path /$path || 
			    $WARN $queue_directory/$path and /$path differ
		done
	done

	$command_directory/postsuper || exit 1

	find corrupt -type f -exec $WARN damaged message: {} \;

	# XXX also: look for weird stuff, weird permissions, etc.
	;;

*)

	$FATAL "usage: postfix start (or stop, reload, abort, flush, or check)"
	exit 1
	;;

esac
@


1.1
log
@Initial revision
@
text
@@


1.1.1.1
log
@Initial import of raw distribution from Weitse Venema
@
text
@@


1.1.1.2
log
@postfix release-20010228
@
text
@a147 1
	$command_directory/postsuper active || exit 1
a148 1
	$command_directory/postsuper &
d190 1
a190 1
	for dir in incoming active bounce defer deferred flush saved corrupt; do
d230 1
a230 29
	# Look for incomplete upgrades.

	test -f $config_directory/master.cf || {
		$FATAL no $config_directory/master.cf file found
		exit 1
	}
	grep 'flush.*flush' $config_directory/master.cf >/dev/null || {
		$WARN adding missing entry for flush service to master.cf
		cat >>$config_directory/master.cf <<EOF
flush	  unix	-	-	n	1000?	0	flush
EOF
	}
	found=`$command_directory/postconf -h hash_queue_names`
	missing=
	(echo "$found" | grep active >/dev/null) || missing="$missing active"
	(echo "$found" | grep bounce >/dev/null) || missing="$missing bounce"
	(echo "$found" | grep defer >/dev/null)  || missing="$missing defer"
	(echo "$found" | grep flush >/dev/null)  || missing="$missing flush"
	(echo "$found" | grep incoming>/dev/null)|| missing="$missing incoming"
	(echo "$found" | grep deferred>/dev/null)|| missing="$missing deferred"
	test -n "$missing" && {
		$WARN fixing main.cf hash_queue_names for missing $missing
		$command_directory/postconf -e hash_queue_names="$found$missing"
	}

	# See if all queue files are in the right place.

	$command_directory/postsuper active
	$command_directory/postsuper &
@


1.1.1.3
log
@postfix 20010228-pl02
@
text
@d196 1
a196 1
			chmod 700 $dir; $CHATTR $dir 2>/dev/null
@


