To be honest it took me more work then that.
I made a complete automated system. I don't have a sa-update.sh in /usr/local/directadmin/custombuild either. I'm using CB 2.0.
I changed the update in options.conf to weekly. Then if all is correct it should make a sa-update (without .sh) in /etc/cron.weekly if not I make it myself. So yours should be in /etc/cron.daily. Like this:
Code:
#!/bin/sh
#VERSION=1.0
#Place this into a cron location, such as:
#/etc/cron.weekly/sa-update.sh
#and chmod to 700
LOG=/var/log/sa-udpate.log
if [ -s ${LOG} ]; then
if [ -e ${LOG}.2 ]; then
rm -f ${LOG}.2
fi
if [ -e ${LOG}.1 ]; then
mv -f ${LOG}.1 ${LOG}.2
fi
mv -f ${LOG} ${LOG}.1
fi
/usr/bin/sa-update -D --nogpg > ${LOG} 2>&1
RET=$?
if [ "$RET" -ge 4 ]; then
echo "Error updating SpamAssassin Rules. Code=$RET";
echo "";
cat $LOG
else
killall -9 spamd >/dev/null 2>&1
/usr/bin/spamd -d -c -m 15 --ipv4 >> ${LOG} 2>&1
fi
exit $RET;
The I take 1 domain and setup the spam settings in there, for example like this (in short):
Delete spam (I don't use spambox by default)
Score on 7.5
Delete on 15
Change header.
Change those values to what you want to have as default values for new users and new domains.
Then I make a directory somewhere, for example I make /root/spamsetting and start copying files made for this 1 domain/user.
Code:
cp /home/user/.spamassassin/user_prefs /root/spamsetting
cp /etc/virtual/domein/filter /root/spamsetting
cp /etc/virtual/domein/filter.conf /root/spamsetting
Now I've got those default settings, I can implement them for any new domain I make automatically by using the custom build scripts domain_create_post and user_create_post.
This is my domain_create_post.sh:
Code:
cp -f /root/spamsetting/filter /etc/virtual/$domain/filter >/dev/null 2>&1
cp -f /root/spamsetting/filter.conf /etc/virtual/$domain/filter.conf >/dev/null 2>&1
chown mail:mail /etc/virtual/$domain/filter
chown mail:mail /etc/virtual/$domain/filter.conf
chmod 640 /etc/virtual/$domain/filter
chmod 600 /etc/virtual/$domain/filter.conf
And the user_create_post.sh
Code:
#!/bin/sh
if [ "$spam" = "ON" ]; then
DIR=/home/$username/.spamassassin
mkdir $DIR
cp -f /root/spamsetting/user_prefs $DIR/user_prefs #or this is where you'd copy the default user_prefs you want them to have, instead of touch".
chown ${username}:mail $DIR
chmod 771 $DIR
chown $username:$username $DIR/user_prefs
chmod 755 $DIR/user_prefs
touch $DIR/spam
chown mail:$username $DIR/spam
chmod 660 $DIR/spam
fi
exit 0;
By the way, I do "locate spamupdate" and I also find /usr/bin/sa-update next to /etc/cron.weekly/sa-update and the manual and some other stuff.