delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/11/17/20:36:49

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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; q=dns; s=default; b=VdAE7vAcLqqh2ccywCzy4uBwH2gR8
ODLv2tOgbu5nZSASin5aNhjoKWQ3pwHh+U0hfV8goBW6nRSdtcNbIUdHO92+DBw4
8MiUlvR2LNpVsKv2PjPjrJRdwK8hO163IWBw2K6PX7jdNJ3jf8JvPTeDSSaYrNGL
4OHp7JoS66FuEo=
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:from:to:subject:date:message-id:references
:in-reply-to:content-type:content-transfer-encoding
:mime-version; s=default; bh=XRe5Yt+RJUUh34y849CkGo29fuo=; b=Vz8
E345dzUmBzVoHFn2OrEaHcdxV1QEL0ALXXaiFw3eHFwBPJeobaqw7NnOsVE7E9As
YxLMknbojYk5D503tYeXxFgEjDFCSitpH7D2q1CF6+aYVO9YeMA9QYcuRz+5iSRd
PlAc7VrxL4YEh6KmwDzzJGrcAyfWwOyZfuSRDAcE=
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 autolearn=ham version=3.3.2
X-HELO: smtp-fr.alcatel-lucent.com
From: "Kertz, Denis (D)** CTR **" <d DOT kertz AT alcatel-lucent DOT com>
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: RE: Can't Run Excel From A Cron Job Under Windows 7
Date: Tue, 18 Nov 2014 01:36:19 +0000
Message-ID: <883F2CBBC85A62419E181EB2F0ECF21F3E11CABC@US70UWXCHMBA04.zam.alcatel-lucent.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> <1991456701 DOT 20141112231225 AT yandex DOT ru> <883F2CBBC85A62419E181EB2F0ECF21F3E118381 AT US70UWXCHMBA04 DOT zam DOT alcatel-lucent DOT com> <1375040469 DOT 20141114012521 AT yandex DOT ru>
In-Reply-To: <1375040469.20141114012521@yandex.ru>
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id sAI1afD5017412

>>> Try starting cron in terminal session and see if anything comes up.
>
> Stop (don't kill! Everyone, who use -KILL, must be -KILL'ed) the cron service,
> then start cron in terminal, using `runas /user:... ...'. So it would run
> under proper user, and see if anything come up, when it execute your excel
> job.

I was unable to find how to use runas from a terminal.  I can simply type runas and it does nothing and I can't find --help or /help.  I did find a suggestion to use cygstart so I tried this:

$ cygstart --action=runas '/bin/cygrunsrv --start cron'
Unable to start 'C:\cygwin64\bin\cygrunsrv --start cron': The specified file was not found.

So that didn't work.  I did try starting the cron service (cygrunsrv) from a terminal session run as administrator and I tried starting the cron service from the Windows services.msc.  Nothing has worked for running an Excel program with my run.excel script.

I created a "null" .xls file that does nothing when run by Excel.  I can run my script (run.excel  c:/Shared/Bin/null.xls) from a bash prompt and it does nothing (as expected) and terminates but when I run this same script from a cron job Excel starts but never terminates.  Running a ps command I see this:

$ ps
      PID    PPID    PGID     WINPID   TTY     UID    STIME COMMAND
     5188    1184    5188       4928  ?       1000 19:00:01 /usr/bin/sh
     6040    5820    5188       4428  ?       1000 19:00:02 /cygdrive/c/Windows/System32/wscript  <-- runs vb script that starts Excel
     1808    4464    1808       5704  ?       1000 18:24:25 /usr/sbin/cron
     5184    5540    5184       6048  pty1    1000 21:13:03 /usr/bin/bash
     3368    5184    3368       5560  pty1    1000 19:00:25 /usr/bin/ps
     5820    5188    5188       5820  ?       1000 19:00:02 /usr/bin/sh
     4464       1    4464       4464  ?       1000 18:24:25 /usr/bin/cygrunsrv
     1184    1808    1808       1184  ?       1000 19:00:01 /usr/sbin/cron
     5540       1    5540       5540  ?       1000 21:13:03 /usr/bin/mintty
$

And I see the Excel.Exe *32 in the process list of Task Manager so I know Excel was started.

Note the above ps command shows the wscript command running which is the command that executes the vb script that runs Excel.  Also note that all of these processes including the wscript command show the 1000 UID which is the Upar2 login UID in the /etc/passwd file.

I also look in the services.msc window and the cron service properties shows Login As .\Upar2.  I see the same on the WinXP PC where I can run Excel successfully from a cron job.

Denis

--
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