• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

How to run this Scheduled task?

Commander

Basic Pleskian
I am trying to setup this scheduled task, but I can't get it running correctly in Plesk "Scheduled Tasks".

The Command line I want to run is this:
C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --nogpg --channelfile UpdateChannels.txt

I tried this in Path to executable file:
C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --nogpg --channelfile UpdateChannels.txt

But I got error:
Failed with error: 'C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --nogpg --channelfile UpdateChannels.txt' is not recognized as an internal or external command, operable program or batch file.

------------------
So I tried separating the arguments and tried this in Path to executable file:
C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe
Arguments:
-v --nogpg --channelfile UpdateChannels.txt

I got "Output" Error:
cannot open UpdateChannels.txt for reading: No such file or directory

-------------------
So I tried adding the full path to the argument filename and tried this in Path to executable file:
C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe
Arguments:
-v --nogpg --channelfile "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"

I got "Output" error:
Update available for channel updates.spamassassin.org: -1 -> 1691495
config: no configuration text or files found! do you need to run 'sa-update'?
Timeout::_run: check: no loaded plugin implements 'check_main': cannot scan!
Check the necessary '.pre' files are in the config directory.


The problem seems to be that when plesk runs the executable, it's not setting the "Start In" path to the path of the executable, so when the executable runs and tries to look for files in the same path as itself, it can't find them because the "Start In" path is not set properly by Plesk.

What I mean by the "Start In" path is the same like when you are editing a windows shortcut, it has a "Start In" path setting in the LNK file settings. This is the "default" path that the executable will look in for other files. If you don't specify a "Start In" path in a windows shortcut, then the executable might not work properly if it tries to find additional files where the executable is located.

The fact that I got the "cannot open UpdateChannels.txt for reading: No such file or directory" just proves my point because the executable was not able to find the file "UpdateChannels.txt" even though it is located in the SAME directory as the sa-update.exe file. For the sa-update.exe file to not find the UpdateChannels.txt file located in the same directory, just means that "Start in" path was not set to the same path as the exe file.

So, how can I get the above scheduled task running properly?
 
Please tell me why you do not use Spamassassin from Plesk distribution kit? As far as I see you have installed non-Plesk Spamassassin.
 
Hi,

Due to some limitations with having Plesk manage my mail server (smartermail), I disabled Plesk from managing smartermail, so I am managing smartermail myself manually.

I also installed spamassassin manually so Smartermail could use it because I couldn't figure out a way to know if plesk's version of spamassasin was running or not and smartermail didn't seem like it was able to see plesk's spamassassin server.

I also setup my copy of spamassassin to run as a service so it will be more reliable, which I don't think Plesks' version can do (and I couldn't find many docs on plesk's spamassassin implementation).

So, how can I run that update task as a scheduled task?
 
I tried this in Path to executable file:
C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --nogpg --channelfile UpdateChannels.txt

But I got error:
Failed with error: 'C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --nogpg --channelfile UpdateChannels.txt' is not recognized as an internal or external command, operable program or batch file.

Always include paths in double quotes if a path contains a space, for example:

C:\Users\Administrator>C:\Program Files (x86)\Parallels\Plesk\bin\admin.exe --help
'C:\Program' is not recognized as an internal or external command,operable program or batch file.


C:\Users\Administrator>"C:\Program Files (x86)\Parallels\Plesk\bin\admin.exe" --help

Available commands:
--update or -u Sets administrator's preferences
--info or -i Shows administrator's information
--xml-info or -xi Shows administrator's information in xml format
 
For the "Path to executable file" textbox, it seems quotes are not needed even if a space is in the path because even plesk's own below scheduled task of "Daily web statistics analyzers run task" has spaces in it's path and it's not enclosed in quotes:

C:\Program Files (x86)\Parallels\Plesk\admin\bin\web_statistics_executor.exe

Also, as I posted, I am enclosing the path for the "UpdateChannels.txt" file in quotes in the arguments textbox:

"C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"

But as I explained, the update doesn't work and gives the error I posted.

As a test, if I open a DOS command window and navigate to the directory "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows" and run the below command line, it works fine:

C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --nogpg --channelfile UpdateChannels.txt

So, what am I doing wrong?
 
Is your UpdateChannels.txt readable/writeable? To make it easy, set the security permissions to full access for Everyone.
 
The permission are fine because if I open a command prompt and navigate to this directory and run that sa-update.exe with the specified parameters it runs fine:

C:\Program Files (x86)\JAM Software\SpamAssassin for Windows>sa-update.exe -v --
nogpg --channelfile "C:\Program Files (x86)\JAM Software\SpamAssassin for Window
s\UpdateChannels.txt"
Update finished, no fresh updates were available

C:\Program Files (x86)\JAM Software\SpamAssassin for Windows>

....and just to make sure, I did set the permissions to everyone and it still failed as in my first post
 
Hi Commander,

at the official Jam Software help pages, you could see, that the suggested standard command would be:

sa-update.exe --nogpg --verbose --channelfile=UpdateChannels.txt --updatedir="C:\ProgramData\JAM Software\spamdService\sa-rules"

Please be aware that all standard configurations ( for this specific Jam Software Spamassassin version ) are done over the global configuration file "Service.config", which you should find at:

..\JAM Software\spamdService\
( where the path depends on your used OS and installation path )


As IgorG suggested above, a command from outside any folders with spaces should look like:
C:\Users\Administrator>"C:\Program Files (x86)\Parallels\Plesk\bin\admin.exe" --help
This implies, that IF you use a scheduled task, it is wise to enclose ALL parameter in quotes in your cimmand, to avoid mistakes. As for example:

C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --nogpg --channelfile UpdateChannels.txt
should look like this ( be aware, that I add the suggestions from the official Jam Software help-pages! ):

"C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe" --nogpg --verbose --channelfile=UpdateChannels.txt --updatedir="C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-rules"


For further possible parameters for "sa-update.exe", please use the command:

"C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe" --help

... and post them here, because we don't have this program installed on our systems and don't know the output and therefore don't know possible parameters.
 
Hi,

I downloaded the "free" SpamAssassin from here:

http://www.jam-software.com/spamassassin/

Apparently, the free version does NOT offer spamd process to run as a service, so there is no such directory "--updatedir="C:\ProgramData\JAM Software\spamdService\sa-rules"

The free version of SA does come with a batch file called "sa-update.bat" and its contents are:

sa-update.exe -v --nogpg --channelfile UpdateChannels.txt

And if I open a command prompt in the same directory as this batch file "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\", then run this batch file, EVERYTHING works just fine.

It's when I try running this batch file with Plesk that I am having trouble. If I try to run this batch file as is from plesk, I get the below error:

Failed with error: 'C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --nogpg --channelfile UpdateChannels.txt' is not recognized as an internal or external command, operable program or batch file.

and if I then place quotes around the txt file like you suggested:

sa-update.exe -v --nogpg --channelfile "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"

Then I get the below error:

Update available for channel updates.spamassassin.org: -1 -> 1691495
config: no configuration text or files found! do you need to run 'sa-update'?
Timeout::_run: check: no loaded plugin implements 'check_main': cannot scan!
Check the necessary '.pre' files are in the config directory.


And if I skip using the batch file alltogether and try to run sa-update.exe and specify the parameters separately in Plesk scheduled tasks, I still can not get it running.

Please download the free version of spamassassin yourself so you can see all the problems in trying to get plesk to run the update.

As per your request, the sa-update.exe --help results in this:
---------------------
C:\Program Files (x86)\JAM Software\SpamAssassin for Windows>sa-update --help
For more information read the sa-update man page.

Usage:
sa-update [options]

Options:

--channel channel Retrieve updates from this channel
Use multiple times for multiple channels
--channelfile file Retrieve updates from the channels in the file
--checkonly Check for update availability, do not install
--install filename Install updates directly from this file. Signature

verification will use "file.asc" and "file.sha1"
--allowplugins Allow updates to load plugin code
--gpgkey key Trust the key id to sign releases
Use multiple times for multiple keys
--gpgkeyfile file Trust the key ids in the file to sign releases
--gpghomedir path Store the GPG keyring in this directory
--gpg and --nogpg Use (or do not use) GPG to verify updates
(--gpg is assumed by use of the above
--gpgkey and --gpgkeyfile options)
--import file Import GPG key(s) from file into sa-update's
keyring. Use multiple times for multiple files
--updatedir path Directory to place updates, defaults to the
SpamAssassin site rules directory
(default: C:\Perl\site/var/spamassassin/3.003001)
--refreshmirrors Force the MIRRORED.BY file to be updated
-D, --debug [area=n,...] Print debugging messages
-v, --verbose Be more verbose, like print updated channel names
-V, --version Print version
-h, --help Print usage message
 
Hi Commander,

could you please read again the suggestion above?

"C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe" --nogpg --verbose --channelfile=UpdateChannels.txt --updatedir="C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-rules"

If you don't have the suggested update - directory ( as stated by Jam Software ), you could either define the standard one ( please see your output from the "--help" ), or you just skip this part.
But you definetely should use --channelfile="C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt" and not your command with the space instead of.

It might be as well a good idea to use the "-D" string ( debug - modus ) as well, when you test the command, just to get a more detailled output in case of possible issues/failures.
 
OK, the problem is definitely with Plesk. Here's why:

If I navigate a DOS prompt to the directory where the "sa-update.bat" file is located, then manually run the batch file, everything runs without any errors are shown below:

saupdate-bat-works.jpg


As you can see the contents of the batch file are:

sa-update.exe -v --nogpg --channelfile "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"

Notice there is no "=" sign after the --channelfile switch, and yet it still runs ok.

But, just to make sure I am covering all bases, I added the "=" to the "Arguments" textbox of the plesk scheduled task so it looks like this:

-v --debug --nogpg --channelfile="C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"

(the "Path to executable" is set to: C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe)

I ran the plesk scheduled task and the plesk email notification I received had this in it:

Code:
Running task: C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe -v --debug --nogpg --channelfile="C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"
Started: Wed Aug 12 10:09:15 2015
The task output is attached to the e-mail Ended with code 255: Wed Aug 12 10:09:16 2015

The attached "utility's output.txt" file is located here:

http://max-soft.com/Plesk-UtilityOutput.txt

As you can see, using plesk to run the update gives errors, but running the batch file from the dos prompt doesn't. So this is proof that Plesk is doing something wrong.

What else do you want me to try?
 
Last edited:
Once again, I would like to remind you, that the cronjob doesn't start by moving to the folder, like you do manually. As IgorG already cleared up, you always should use double quotes, when your command contains spaces and/or special signs ( as for example "(" or ")".

Always include paths in double quotes if a path contains a space, for example:

C:\Users\Administrator>C:\Program Files (x86)\Parallels\Plesk\bin\admin.exe --help
'C:\Program' is not recognized as an internal or external command,operable program or batch file.


C:\Users\Administrator>"C:\Program Files (x86)\Parallels\Plesk\bin\admin.exe" --help

Available commands:
--update or -u Sets administrator's preferences
--info or -i Shows administrator's information
--xml-info or -xi Shows administrator's information in xml format

Please always try your command for the desired cronjob from "C:\" and don't try to manually move into the folder, where the executable is located, to test the full command.
 
This is the first time you are mentioning a "cronjob" - what is this?

Why do you keep bringing up the issue with the quotes when you can clearly see in my recent post that I am already using quotes?

So, what else can I try?
 
I even tried having plesk run the batch file (instead of the exe with parameters), and YES I USED QUOTES:

Path to Executable: "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.bat"

And got this result:

Running task: "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.bat"
Started: Wed Aug 12 12:51:37 2015
The task output is attached to the e-mail Ended with code 255: Wed Aug 12 12:51:38 2015


And the email attachment output was:

C:\Windows\system32>sa-update.exe -v --nogpg --channelfile "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"
Update available for channel updates.spamassassin.org: -1 -> 1695228
config: no configuration text or files found! do you need to run 'sa-update'?
Timeout::_run: check: no loaded plugin implements 'check_main': cannot scan!
Check the necessary '.pre' files are in the config directory.


So, even that didn't work.

So why can't Plesk run this, but yet running the batch file or running a shortcut to the batch file runs with no errors?
 
If you were referring to me not using quotes for the "Path to executable:" line, then I just added quotes below to make sure I am doing everything you are suggesting:

Path to executable:

"C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe"

And I still got the SAME exact result as in my post #12.

What else do you suggest I do to get this working?
 
Last edited:
I tried this:

Path to executable:

"C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe" --nogpg --verbose --channelfile=UpdateChannels.txt

Arguments:

[blank]

And got this error:

Running task: "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe" --nogpg --verbose --channelfile=UpdateChannels.txt
Started: Wed Aug 12 13:10:13 2015
Failed with error: '""C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe" --nogpg --verbose --channelfile=UpdateChannels.txt" ' is not recognized as an internal or external command, operable program or batch file.Wed Aug 12 13:10:13 2015


---------------------------------------------------------
I then tried this:

Path to executable:

"C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe"

Arguments:

--nogpg --verbose --channelfile=UpdateChannels.txt

And got this email response:

Running task: "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe" --nogpg --verbose --channelfile=UpdateChannels.txt
Started: Wed Aug 12 13:13:54 2015
The task output is attached to the e-mail Ended with code 2: Wed Aug 12 13:13:55 2015


And with this output:

cannot open UpdateChannels.txt for reading: No such file or directory

---------------------------------------------------------
So I then tried this:

Path to executable:

"C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe"

Arguments:

--nogpg --verbose --channelfile="C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"

And got this email response:

Running task: "C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update.exe" --nogpg --verbose --channelfile="C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\UpdateChannels.txt"
Started: Wed Aug 12 13:16:42 2015
The task output is attached to the e-mail Ended with code 255: Wed Aug 12 13:16:43 2015


And this output:

Update available for channel updates.spamassassin.org: -1 -> 1695228
config: no configuration text or files found! do you need to run 'sa-update'?
Timeout::_run: check: no loaded plugin implements 'check_main': cannot scan!
Check the necessary '.pre' files are in the config directory.


So, please tell me were I forgot to use quotes, or what else I am doing wrong?
 
Last edited:
Looks like I just figured out the fix myself...and no quotes were needed! ;)

I made a copy of the default batch file and simply added a "CD" command to it, so the batch file contents are:

cd C:\Program Files (x86)\JAM Software\SpamAssassin for Windows
sa-update.exe -v --nogpg --channelfile=UpdateChannels.txt


And it seems to work fine!

Email body:

Running task: C:\Program Files (x86)\JAM Software\SpamAssassin for Windows\sa-update-cd.bat
Started: Wed Aug 12 13:37:01 2015
The task output is attached to the e-mail Ended with code 1: Wed Aug 12 13:37:01 2015


Output.txt:

C:\Windows\system32>cd C:\Program Files (x86)\JAM Software\SpamAssassin for Windows
C:\Program Files (x86)\JAM Software\SpamAssassin for Windows>sa-update.exe -v --nogpg --channelfile=UpdateChannels.txt
Update finished, no fresh updates were available
 
Back
Top