SID-00143: email notifications and Windows
| Status: |
Answered |
TWiki version: |
4.2.4 |
Perl version: |
Perl 5.10.0 Build 1004 |
| Category: |
CategoryEmail |
Server OS: |
Windows Server 2003 SP2 |
Last update: |
14 years ago |
Windows and the examples given in "Setting up your cron jobs" don't appear to be compatible. "Notify" is not working. I'm not getting any emails from it.
My IT guys say they have a cron job set up, per the instructions, that should be sending me notifications on a regular basis. Not happening.
They tell me that the cron details in "Setting up your cron job(s)" appear to be for Linux. Can anybody help with how to get the Notify cron job to work with Windows?
Also, as far as Twiki is concerned, is there anything that needs to be entered differently between Windows vs Linux for the scripting on the individual webs and/or topic pages to make webnotify work?
--
JohnWegner - 27 Feb 2009
Discussion and Answer
Google:windows+cron
--
PeterThoeny - 02 Mar 2009
The native Windows feature for that is a "Scheduled Task".
I like to run scheduled tasks as the local system account so that there are no issues with password expiry (this works as long as no external resources need to be accessed). Since the GUI for scheduled tasks requires a password to be entered (and
SYSTEM doesn't have one), this has be done with the command line interface. See the
Microsoft documentation
on
schtasks for a description of the flags used in these examples:
-
schtasks /create /ru SYSTEM /sc hourly /tn "Hourly Jobs" /st 15:00 /tr "D:\scripts\HourlyJobs.bat" /F
-
schtasks /create /ru SYSTEM /sc weekly /tn "Friday Job" /st 07:00 /d FRI /tr "perl D:\scripts\TWiki_Weekly_Maint.pl" /F
--
SeanCMorgan - 02 Mar 2009
Hi John,
I had the same problem as well. I never received any email notifications when using a cron job on an windows based system.
So I did 3 small steps to get my mail notifications working...
- Under your /twiki/tools create an BAT file which contains the following commands (name it as mailnotify.bat)
cd d:\twiki\twiki\tools perl -I /twiki/twiki/bin mailnotify
Please change the above DOS commands to match your twiki location
- Open the mailnotify perl script (usually lies under /twiki/tools) change the First line to match your perl bin location. (my perl is been installed on C drive, so I have put up as c:\perl\bin\perl -w )
- Just for testing purpose execute the mailnotify.bat file before proceeding to next step. You must see a change notification email in your mail box
- Now goto Control panel and open Scheduled Task and Add an new task that executes mailnotify.bat
This would do the rest !
--
RajeshN - 05 Mar 2009
Good method
RajeshN! I played with running mailnotify from the command line a few times as some the file dependencies were being found. I'd run the script, see which file was not found, do search and use the "perl -I" function to include the parent directory for the file. I had to do this 3 times before the mailnotify functionality worked.
--
DavidWarner - 2011-06-14
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.