mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2025-04-07 00:47:05 +00:00
mail-postfix.sh: mv instead of cp to prevent stale files
This commit is contained in:
parent
3d8a518beb
commit
6eff1b04fa
@ -245,21 +245,19 @@ tools/editconf.py /etc/postfix/main.cf \
|
|||||||
tools/editconf.py /etc/default/postgrey \
|
tools/editconf.py /etc/default/postgrey \
|
||||||
POSTGREY_OPTS=\""--inet=127.0.0.1:10023 --delay=180 --dbdir=$STORAGE_ROOT/mail/postgrey/db"\"
|
POSTGREY_OPTS=\""--inet=127.0.0.1:10023 --delay=180 --dbdir=$STORAGE_ROOT/mail/postgrey/db"\"
|
||||||
|
|
||||||
# Make destination postgrey database directory under $STORAGE_ROOT
|
|
||||||
mkdir -p $STORAGE_ROOT/mail/postgrey/db
|
|
||||||
|
|
||||||
# If the $STORAGE_ROOT/mail/postgrey is empty, copy the postgrey database over from the old location
|
# If the $STORAGE_ROOT/mail/postgrey is empty, copy the postgrey database over from the old location
|
||||||
if [ ! "$(ls -A $STORAGE_ROOT/mail/postgrey/db)" ]; then
|
if [ ! -d $STORAGE_ROOT/mail/postgrey/db ]; then
|
||||||
# Stop the service
|
# Stop the service
|
||||||
service postgrey stop
|
service postgrey stop
|
||||||
# Copy over the databse.
|
# Ensure the new base path for postgrey exists
|
||||||
# We didn't cp -p to preserve perms since we have to chown the newly created directory above anyway.
|
mkdir -p $STORAGE_ROOT/mail/postgrey
|
||||||
# There really shouldn't be any folders in this path, but if there are for any reason cp fails without -r (recursive).
|
# Move over database
|
||||||
cp -r /var/lib/postgrey/* $STORAGE_ROOT/mail/postgrey/db
|
mv /var/lib/postgrey $STORAGE_ROOT/mail/postgrey/db
|
||||||
fi
|
fi
|
||||||
# Fix permissions
|
# Ensure permissions are set
|
||||||
chown -R postgrey:postgrey $STORAGE_ROOT/mail/postgrey/
|
chown -R postgrey:postgrey $STORAGE_ROOT/mail/postgrey/
|
||||||
chmod 700 $STORAGE_ROOT/mail/postgrey/
|
chmod 700 $STORAGE_ROOT/mail/postgrey/{,db}
|
||||||
|
|
||||||
# We are going to setup a newer whitelist for postgrey, the version included in the distribution is old
|
# We are going to setup a newer whitelist for postgrey, the version included in the distribution is old
|
||||||
cat > /etc/cron.daily/mailinabox-postgrey-whitelist << EOF;
|
cat > /etc/cron.daily/mailinabox-postgrey-whitelist << EOF;
|
||||||
|
Loading…
Reference in New Issue
Block a user