2

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!

ilter
  • 123
  • 1
  • 6

3 Answers3

4

I successfully got Spamd.exe to run as a service on Windows Server 2012R2 using srvany.exe. It's not supported on 2012R2 but it works just fine for this purpose.

First get srvany.exe from the Windows Server 2003 resource kit and make sure it's installed in c:\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:

sc create Spamd binPath= C:\Windows\System32\srvany.exe DisplayName= "SpamAssassin Daemon"

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 the C:\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.

c4f4t0r
  • 5,301
  • 3
  • 31
  • 42
Gimli
  • 41
  • 1
  • 1
    Thanks for the detailed information :) It's been a while since I gave up on this but will definitely try that. – ilter May 04 '15 at 22:37
2

You are getting the dreaded "Error 1053" because spamd.exe is not a true Windows Service and it can not respond properly to your request to start the service. You will need to use a "service wrapper" (like Microsoft's srvany, but there are others too) that can accept your request to start the service and kick off spamd.exe instead.

CoreTech
  • 151
  • 3
0

Consider using Non-Sucking Service Manager. It works great and has both 32bit and 64bit versions available. It can detect if the executable failed on startup and restart it amongst a host of other features including a graphical service installation and removal facility. Highly recommended, BY ME! (No affiliation, just a happy user.)

Doug Wilson
  • 1,313
  • 2
  • 9
  • 7