This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Can't Run Excel From A Cron Job Under Windows 7


On Nov 12, 2014, at 9:20 AM, Kertz, Denis (D)** CTR ** <d.kertz@alcatel-lucent.com> wrote:

>> More like you expect to run Excel interactively from service.
>> Not possible. Period.
> 
> I'm not trying to run Excel interactively from a cron job.  One of the limitations with using Excel from a cron job is Excel has to run error free. 

That’s not the key issue here.

Windows does not allow a service to have a GUI, at all.[1]  Unless Excel is smart enough to not even start its GUI loop when it sees that it is running as a service — as it will be when running under “cron as service” — it will fail.

You were offered a choice when running cron-config: to run as a service or not.  If you installed it as a service, try removing the Cygwin cron service[2] and reinstalling it to run under your user account.  I tested it here, and a Bash script was able to launch notepad.exe via cron when run this way.

(I did not test the run-as-service case since I haven’t changed my user permissions per[3] on my test VM, and I don’t want to.  And per above, I do not think it would succeed anyway.)

This means you will have to leave that computer logged in all the time.  You also need to ensure that /usr/sbin/cron.exe starts on each login.  As soon as you log out — and possibly if the desktop gets locked — cron will go back to failing to run GUI programs.

If this also fails, try using the Windows Task Scheduler instead.  It’s more suited to this sort of task.

For that matter, why bring Cygwin into this at all?  You’re clearly already familiar with VBScript, so why not create a VB app to do all the CreateObject() stuff?

If your excuse is that you don’t have Visual Studio, then you have no excuse, since there is a free version that will suffice for such a simple task.[4][5]


[1] http://stackoverflow.com/questions/53232/
[2] cygrunsrv -R cron
[3] http://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1
[4] http://www.visualstudio.com/products/visual-studio-express-vs
[5] Beware, VSE will go away eventually: http://goo.gl/Cjmq2q
--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]