delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/12/21/19:06:00

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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=BzhofyV4vCApexM1
VX6vOQqyECppquOO9gieNwQyR7Ey+PWi2ECRCt+6bJT0EZK2GTQ9GyKqDhblZF2H
NIiUPiKTgAAQXqu1a9GiCboDWKb1nYFv6HH+n6NivtPftVpAdiU3i7Ph32h10loI
tytWFGS4NCYulQHx6gWjFkVSIqU=
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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=D/xrCUPcCVfW9/RdoSjOeY
Ox7Sw=; b=rLP7mLt5q8VZwrwsIaUNGPSugtDtMD/EZzhSx/0Q/ETszH3zqmo9aE
PkHWbKKKO/Wy4Mh24WmraZeCeShtAyIXbuuCOLtzX+BjWWKJmvgc0amJXkTOZetv
Y9dNKqXf/6+gHLrdE8VisPPMccBqVSa4ZN8tkBiXM0rHqA5fa4znk=
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.7 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_BODY_URIBL_PCCC,KAM_FROM_URIBL_PCCC,KAM_THEBAT,SPF_SOFTFAIL autolearn=no version=3.3.2
X-HELO: smtp.ht-systems.ru
Date: Mon, 22 Dec 2014 03:03:02 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <3610637631.20141222030302@yandex.ru>
To: "Kertz, Denis (D)** CTR **" <d DOT kertz AT alcatel-lucent DOT com>,
cygwin AT cygwin DOT com
Subject: Re: Can't Run Excel From A Cron Job Under Windows 7
In-Reply-To: <883F2CBBC85A62419E181EB2F0ECF21F3E1169F8@US70UWXCHMBA04.zam.alcatel-lucent.com>
References: <883F2CBBC85A62419E181EB2F0ECF21F3E1169F8 AT US70UWXCHMBA04 DOT zam DOT alcatel-lucent DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Kertz, Denis (D)** CTR **!

> I am trying to port a cygwin application that uses cron from a WinXP PC to
> a Win7 Pro PC and I find some cron jobs won't run.  Specifically, I need to
> run an Excel program from a cron job and this doesn't work on my Win7 PC.

For posterity:
Turned out, this has nothing to do with cygwin (predictable), and actually has
to do with how Windows (Vista+) manage services (namely: lack of access to any
GUI, unless you create one for yourself).

The issue has been discussed, for example, at serverfault.com[1] and relevant
MSDN article is [2].
The solution could be to create a stub application, which will make all
necessary calls and then launch your GUI application in prepared environment.

[1] http://serverfault.com/questions/101671/scheduled-tasks-w-gui-issue
[2] http://msdn.microsoft.com/en-us/library/ms687105(VS.85).aspx

> In order to run an Excel program from cygwin I have this run.excel bash
> script with an embedded VB script that executes an Excel program:

>         excel=$1
>         vbscript=/usr/tmp/$$.vbs
>         cat <<-! >$vbscript
>                         Dim xlApp
>                         Set xlApp = CreateObject("Excel.application")
>                         Set xlWb = xlApp.workbooks.Open("$excel")
>                         xlApp.Quit
>                         Set xlWb = Nothing
>                         Set xlApp = Nothing
>         !
>         chmod 777  $vbscript
>         c:/Windows/System32/wscript.exe  'c:\cygwin64\usr\tmp\$$.vbs'

> An excel program is run like this:

>         run.excel  'c:\Shared\Bin\Create_Daily_Scorecard.xls'

> When I run an Excel program interactively with this run.excel script it
> runs just fine but when I run it via a cron job Excel just hangs.  When
> Excel hangs I can look at the processes running on the PC using the Windows
> Task Manager and I don't see the EXCEL.EXE process.  But when I check the
> option to show processes from all users I see the hung EXCEL.EXE process,
> AND the user name displayed is my login.  So I am running this under the
> Upar2 login and Task Manager doesn't display EXCEL.EXE as a Upar2 process
> but when I check 'Show processes from all users' it shows EXCEL.EXE running
> under user name Upar2 - a contradiction.

> What I suspect is happening is Excel is attempting to do something that
> requires Upar2 permission but it isn't really running as Upar2 so Excel
> displays some error message and is waiting for the user to respond.  But
> Excel is running invisibly so this can't be seen.

> I also suspect this Upar2 "confusion" isn't limited to running an Excel
> program.  I can run a cron job with regular UNIX commands (cut, sort, etc)
> and see they are running with the ps command.  But when I try to kill them
> (kill -9) I get permission denied.  If I want to kill a process running via
> the cron I have to start cygwin with 'Run as administrator' and then I can
> kill processes running under the cron.

> So, does anyone know what's going on here and what I need to do get these
> cron jobs running.  As I noted at the beginning this is being ported from
> WinXP, where all this works fine, to Win7.

> I set up cron using cron-config like this:

> $ cron-config
> Do you want to install the cron daemon as a service? (yes/no) yes
> Enter the value of CYGWIN for the daemon: [ ]

> Do you want the cron daemon to run as yourself? (yes/no) yes

> Please enter the password for user 'Upar2':
> Reenter:
> Running cron_diagnose ...
> ... no problem found.

> Do you want to start the cron daemon as a service now? (yes/no) yes
> OK. The cron daemon is now running.

> Denis


--
WBR,
Andrey Repin (anrdaemon AT yandex DOT ru) 22.12.2014, <02:37>

Sorry for my terrible english...


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