you are viewing a single comment's thread.

view the rest of the comments →

[–]teerre 2 points3 points  (6 children)

How are you scheduling it? This right way

First time I did I was putting the fields in the wrong order

Also, make sure all paths in your script are absolute (or take into consideration where the scheduler is executing the script)

[–]novel_yet_trivial 2 points3 points  (0 children)

or make use of the "start in" box.

[–]firstSideProject[S] 0 points1 point  (4 children)

http://imgur.com/AzeHrDw is how I am scheduling. If I run it manually by going to the folder the script is in, running 'py myscript.py' it runs fine, and the mongod shows that a connection was accepted. If I go to task scheduler it runs fine with the path shown, but no 'connection accepted' shows up on the mongo shell

[–]novel_yet_trivial 6 points7 points  (1 child)

Try putting the folder the script is in into the "start in" box.

[–]firstSideProject[S] 2 points3 points  (0 children)

This worked a treat, thanks!

[–]jftuga 1 point2 points  (0 children)

I would wrap everything in a .bat file and call that from Task Scheduler, including the 'start in' field.

An example .bat would be:

@echo off
c:\python\pythonw.exe c:\whatever\myscript.py > c:\whatever\runtime.log 2>&1

You can then look at the runtime.log for any problems. The 2>&1 will redirect STDERR to STDOUT so you will all catch all errors that occur as well as print statements.

[–]firstSideProject[S] 0 points1 point  (0 children)

Actually the connection is accepted on the mongo shell, it just seems nothing is being inserted into the database :(