I am trying to run spamd.exe file which runs the spamassassin for windows, as a windows service. I tried
sc create spamassassin binPath="C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\spamd.exe" DisplayName="Spam Assassin" start=auto
and got
[SC] CreateService SUCCESS
as result.
I can now see "Spam Assassin" in the Services. When I right click on it and select "START" I am getting an error like "Error 1053: The service did not respond to the start or control request in a timely fashion."
There is nearly no topics about sc.exe running spamd.exe file as a service, so I decided to ask that in here.
I know that spamd.exe is capable of running as a Windows Service with an old utility of Microsoft's, SrvAny. But it's too old and not compatible with Windows Server 2012 or x64 executables (That's what I read in the forums).
Can someone tell me why I am getting that 1053 error on the service start, or at least a way to have spamd.exe run as a service in windows server 2012 environment?
Thanks!
Best Answer
I successfully got Spamd.exe to run as a service on
Windows Server 2012R2
usingsrvany.exe
. It's not supported on2012R2
but it works just fine for this purpose.First get
srvany.exe
from theWindows Server 2003
resource kit and make sure it's installed inc:\windows\system32
(I'll use all default paths in this tutorial, modify as needed).Then, from a command prompt with Administrator privileges, run the following command:
Next, open regedit with administrator privileges and navigate to the key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spamd\
Create a sub-key under "
Spamd
" called "Parameters". Under "Parameters" create a string valued called "Application
". Enter "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\spamd.exe
" as a string value for "Application" (including the " as part of the value). Create another string value called "AppParameters
" and enter the following as a string value: <-l -s "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\spamd.log
"> (without the <> but with the "). Create another string value named "AppDirectory
" and enter "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\
" as the value (without ").Once that's done you're good to start the service. Note that the service will start without an error even if there's an error in the
AppParameters
value so make sure to check theC:\Program Files (x86)\JAM Software\SpamAssassin for Windows\spamd.log
log file to make sure SpamD is actually working. If it's not you may need to adjust the paths in the AppParameters value to reflect the proper paths on your system.Once the SpamD service starts with proper content in the log file you're done!
Note that I used a similar service configuration to run ClamAV as a daemon on the same server and that works great too.