delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/11/18/17:50:04

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:content-type:mime-version:subject:from
:in-reply-to:date:content-transfer-encoding:message-id
:references:to; q=dns; s=default; b=rPmtnGo1o8vijFGd4ma6EtV8umo4
YJO0tk5Ez/m4B5F1FlTSdce0D8fn5B23zw8F7wNAxFmpEV3z90AVd9ec4SkAZkl0
I3/tamuBGTH5TXYKrXQxMyIQZ61Ep07jSxQ54V3e9x8QH3q5tp6TU6SeIaqHAO1D
r40o6OoqKtWwTBg=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:content-type:mime-version:subject:from
:in-reply-to:date:content-transfer-encoding:message-id
:references:to; s=default; bh=c7tGUY4EDdiCLIpixOu4/X5UC7c=; b=JU
5yy2ogWqGSfnq3vFik88RhsLJ6Lu/xudzkC2KQcE+JvjTUlWZDBRrJ2ozmoIiiIO
gHdb3DVPGwqVTui1FvTe3pjjGMBrlk2gkEeK50nwgP2rHMvbNr0czA/8n38puery
DrI/UrqlYGJNZ+S/ouNUJriGv6DFqoai8S/BeAHq0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD,URIBL_DBL_ABUSE_REDIR,URIBL_DBL_REDIR autolearn=ham version=3.3.2
X-HELO: etr-usa.com
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
Subject: Re: Can't Run Excel From A Cron Job Under Windows 7
From: Warren Young <warren AT etr-usa DOT com>
In-Reply-To: <883F2CBBC85A62419E181EB2F0ECF21F3E118128@US70UWXCHMBA04.zam.alcatel-lucent.com>
Date: Tue, 18 Nov 2014 15:50:19 -0700
Message-Id: <B613D6A7-C6F4-46C4-908E-3188DEB3FA67@etr-usa.com>
References: <883F2CBBC85A62419E181EB2F0ECF21F3E1169F8 AT US70UWXCHMBA04 DOT zam DOT alcatel-lucent DOT com> <1785488620 DOT 20141111221749 AT yandex DOT ru> <883F2CBBC85A62419E181EB2F0ECF21F3E118128 AT US70UWXCHMBA04 DOT zam DOT alcatel-lucent DOT com>
To: cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id sAIMo0dG006342

On Nov 12, 2014, at 9:20 AM, Kertz, Denis (D)** CTR ** <d DOT kertz AT alcatel-lucent DOT 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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019