Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
themeEmacs
titlesasl.sh
#!/bin/bash
rl=$(readlink /var/run/saslauthd)
if [ "" != "$rl" ] ; then
		echo "/var/run/saslauthd is symlinked already."
		exit
fi

mkdir -p /var/spool/postfix/var/run/saslauthd
chgrp sasl /var/spool/postfix/var/run/saslauthd
adduser postfix sasl
# Problems with /var/run/saslauthd that should be fixed. If it exists, remove it for instance...
rmdir /var/run/saslauthd >/dev/null 2>&1
# Then symlink it away.
ln -sv /var/spool/postfix/var/run/saslauthd /var/run >/dev/null 2>&1
if [ "$?" != "" ] ; then
	echo "Obviously something is wrong here."
	theDate=$(date +'%Y%m%d%H%M')
	mv -v /var/run/saslauthd /var/run/saslauthd-${theDate}
	ln -sv /var/spool/postfix/var/run/saslauthd /var/run
fi

# By the way, if saslauthd is not autostarted, it should really be changed.
sed -i 's/START=no/START=yes/' /etc/default/saslauthd

# Do not forget to restart the daemons.
service postfix restart
service saslauthd restart

...