WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Franais)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
"Start any Program" - service does not work (Read 12718 times)
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
"Start any Program" - service does not work
Sep 6th, 2010 at 3:11pm
 
Hi,

I am testing watchDirectory, version 4.6.2.

Most of the tasks I would need (copy/move/rename) work well when started as a service.

The plugins "Start any Program" or "Run a .bat file" donot work as service - they work fine when started manually (F5) though.

Is this a bug or am I missing something?

tnx
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: "Start any Program" - service does not work
Reply #1 - Sep 6th, 2010 at 3:14pm
 
Hi,

Not a bug, but an unfortunate way services work. See this blogpost how to troubleshoot/fix Services:
http://watchdirftp.blogspot.com/2010/04/watchdirectory-tasks-as-windows-service....

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #2 - Sep 6th, 2010 at 4:28pm
 
I'm afraid this does not help -

I work on local drives only, I have the full path name to the program/bat file provided, no spaces contained, the service is running (I also tried to run this service as a user with admin privileges.).

I must be missing something Sad
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: "Start any Program" - service does not work
Reply #3 - Sep 6th, 2010 at 4:34pm
 
What happens if you enter your OWN user/password for the service?
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: "Start any Program" - service does not work
Reply #4 - Sep 6th, 2010 at 5:03pm
 
Hi Dschuwi,

please note that not all progams can run as services. This has nothing to do with WatchDirectory, you also will not be able to run the program with srvany.exe or other service-making helpers.
Please take start option "auto start folder" together with "keep task running at logoff".
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #5 - Sep 7th, 2010 at 12:18pm
 
Gert wrote on Sep 6th, 2010 at 4:34pm:
What happens if you enter your OWN user/password for the service?


I did try with my own account...
It looks just as if nothing would happen at all.
Back to top
 
 
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #6 - Sep 7th, 2010 at 12:22pm
 
Dirk wrote on Sep 6th, 2010 at 5:03pm:
Hi Dschuwi,

please note that not all progams can run as services. This has nothing to do with WatchDirectory, you also will not be able to run the program with srvany.exe or other service-making helpers.
Please take start option "auto start folder" together with "keep task running at logoff".


Well that's why I tried to run a simple .bat file - it does not even open the command window.
Auto start folder is an option, certainly, but I want to dig into this problem.
Is there a way to find out if watchDirectory does detect the triggering event in the first place - so we could track down where in the processing chain we are stuck?

cheers
hp
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: "Start any Program" - service does not work
Reply #7 - Sep 7th, 2010 at 12:26pm
 
Please check at the machine where wd is installed if the account you are using has the rights to log on as service like described here for Windows 2003 Server:
http://technet.microsoft.com/en-us/library/cc739424(WS.10).aspx?ppud=4
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: "Start any Program" - service does not work
Reply #8 - Sep 7th, 2010 at 12:28pm
 
For "Run a bat file", make sure you have the option
[X] Capture output
enabled.

If your task is called HELLO, and after you drop a file into the directory, it starts your bat file and redirects all output (ECHO HELLO WORLD) to a log file in directory

<taskdirectory>\HELLO\

those files have names like 12345_6789.log
To explore the task-directory, select the menu Tools -> Explore task directory. Good chance you will see error messages in the log files.

You can also look at the history database to see if the files are detected:
http://watchdirftp.blogspot.com/2008/05/how-task-history-works.html
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #9 - Sep 7th, 2010 at 4:27pm
 
Gert wrote on Sep 7th, 2010 at 12:28pm:
For "Run a bat file", make sure you have the option


those files have names like 12345_6789.log
To explore the task-directory, select the menu Tools -> Explore task directory. Good chance you will see error messages in the log files.



The output of the log files is absolutely the same whether WD runs as a service or not:

Code:
E:\WatchDirTest>GOTO :StartOfBat
E:\WatchDirTest>"D:\WA\WatchDirectory\wdAnnotate.exe" info "Starting E:\WatchDirTest\RunTest.bat for event"

E:\WatchDirTest>Call "E:\WatchDirTest\RunTest.bat" FILENEW
E:\WatchDirTest>D:\TESTDIR\TESTPROG.EXE
E:\WatchDirTest>"D:\WA\WatchDirectory\wdAnnotate.exe" info "Done"  



However, when running as a service, "D:\TESTDIR\TESTPROG.EXE" (which is the only line in RunTest.bat) does not get executed, otherwise it does (three times actually, and three log files, even though only one file gets dropped into the monitored directory)

puzzled...
hp
Back to top
 
 
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #10 - Sep 7th, 2010 at 4:28pm
 
Dirk wrote on Sep 7th, 2010 at 12:26pm:
Please check at the machine where wd is installed if the account you are using has the rights to log on as service like described here for Windows 2003 Server:
http://technet.microsoft.com/en-us/library/cc739424(WS.10).aspx?ppud=4

Yes, the account does have the rights, and other WD services do run very well...
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: "Start any Program" - service does not work
Reply #11 - Sep 7th, 2010 at 4:40pm
 
Please try to run your program without WatchDirectory as a service.
How to:
http://support.microsoft.com/kb/137890/en-us
Required files:
http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee...

Let me know if you can run it successfully with this tools.
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: "Start any Program" - service does not work
Reply #12 - Sep 7th, 2010 at 5:57pm
 
Also, as mentioned in the blogpost http://watchdirftp.blogspot.com/2010/04/watchdirectory-tasks-as-windows-service....

Does your program depend on a certain Working Directory? Then set it yourself inside the bat file.
Code:
rem set current dir to D:\Whatever
D:
CD "\Whatever"
 



Does your program depend on certain PATH settings? Then set it yourself inside the bat file.
Code:
SET PATH=%PATH%;D:\testdir;c:\MyDlls
 

Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #13 - Sep 9th, 2010 at 10:31am
 
Dirk wrote on Sep 7th, 2010 at 4:40pm:
Please try to run your program without WatchDirectory as a service.
How to:
http://support.microsoft.com/kb/137890/en-us
Required files:
http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee...

Let me know if you can run it successfully with this tools.

No.
The service is created, successfully, but cannot be started.
However, if I understand it correctly, the WD task should run as a service and consequently start my program if needed - the program itself is not supposed to run as a service, right?
Back to top
 
 
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #14 - Sep 9th, 2010 at 10:36am
 
Gert wrote on Sep 7th, 2010 at 5:57pm:
Also, as mentioned in the blogpost http://watchdirftp.blogspot.com/2010/04/watchdirectory-tasks-as-windows-service....

Does your program depend on a certain Working Directory? Then set it yourself inside the bat file.

Tried - did not help...
Back to top
 
 
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #15 - Sep 9th, 2010 at 10:39am
 
FYI - the custom program is Cyber-D's Autodelete 2.24 (Freeware).

If WD only had an option to autodelete files based on their created/modified file age, I would not need it Wink
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: "Start any Program" - service does not work
Reply #16 - Sep 9th, 2010 at 10:42am
 
One further thing you could try (not recommended by MS) is to change the service property so it is allowed to interact with the desktop (or some such wording).

To use WD's delete task ( http://www.watchdirectory.net/wdhelp/plugins/wdopAutoDelete.html ) based on timestamps, look at the "File Age" monitoring method: http://www.watchdirectory.net/wdhelp/help/detect_old_files.html
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #17 - Sep 9th, 2010 at 11:07am
 
Gert wrote on Sep 9th, 2010 at 10:42am:
To use WD's delete task ( http://www.watchdirectory.net/wdhelp/plugins/wdopAutoDelete.html ) based on timestamps, look at the "File Age" monitoring method: http://www.watchdirectory.net/wdhelp/help/detect_old_files.html


Uh-oh... I did try this before, tried again now, seems to work.
There was only one uncertainty, I could not accurately test:

Can you confirm, ONLY files that actually triggered due to their age, will be deleted?

After my first tests I had the impression, after ONE file had triggered, ALL files according to the filter criteria would be deleted...

Since autodelete is a rather dangerous task, maybe this should be clarified directly in WD's settings window.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: "Start any Program" - service does not work
Reply #18 - Sep 9th, 2010 at 11:14am
 
confirmed

Also, please read this blogpost (about  "remember triggered files"):
http://watchdirftp.blogspot.com/2009/01/file-age-monitoring-method.html
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: "Start any Program" - service does not work
Reply #19 - Sep 9th, 2010 at 11:14am
 
oh, and to re-iterate what Dirk said somewhere: some programs just can not run in a service context.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Dschuwi
YaBB Newbies
*
Offline



Posts: 14
Re: "Start any Program" - service does not work
Reply #20 - Sep 9th, 2010 at 11:27am
 
Gert wrote on Sep 9th, 2010 at 11:14am:
confirmed

Also, please read this blogpost (about "remember triggered files"):
http://watchdirftp.blogspot.com/2009/01/file-age-monitoring-method.html


Wow. Great. Perfect program. Thanks!

I need to run it 24/7 on an FTP server, will keep testing it for the rest of the trial period, and then eventually kick out it's competitor, which is outdated and not only by its name behaves like an ape in the trees Wink

Cheers
hp
Back to top
 
 
IP Logged
 
Dirk
YaBB Administrator
*****
Offline



Posts: 658
South Germany
Re: "Start any Program" - service does not work
Reply #21 - Sep 10th, 2010 at 3:01pm
 
Dschuwi,

Quote:
No.
The service is created, successfully, but cannot be started.
However, if I understand it correctly, the WD task should run as a service and consequently start my program if needed - the program itself is not supposed to run as a service, right?


I have overlooked your posting, sorry.
Yes - I f you were not able to run your program as service with those MS tools, it cannot run as service. Your problem is not WatchDirectory-related, its application-related. I have several customers with exact the same problem.
You may contact the the programmer, maybe he is willing to change it.
Back to top
 

Viele Gre / Best regards
Dirk - GdP Software

dirk [at] gdpsoftware [dot] com
http://blog-de.gdpsoftware.com
Webseite: http://www.gdpsoftware.com
WWW WWW  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: "Start any Program" - service does not work
Reply #22 - Sep 10th, 2010 at 3:14pm
 
Just to add to Dirk's remarks...

99% of programs that are *really* command line (you know, you can start it in a "dos box") can be run in a service context as long as they do not ask questions but just "do it".

Programs that open a graphic user interface, with dialogs asking you "Are  you sure you want to delete..." are impossible to run in a service context because there is no user present to press OK.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1