From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23382 invoked by alias); 12 Nov 2014 20:31:45 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 23355 invoked by uid 89); 12 Nov 2014 20:31:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_20,FREEMAIL_FROM,FREEMAIL_REPLY,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ig0-f182.google.com Received: from mail-ig0-f182.google.com (HELO mail-ig0-f182.google.com) (209.85.213.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 12 Nov 2014 20:31:41 +0000 Received: by mail-ig0-f182.google.com with SMTP id hn18so3655179igb.15 for ; Wed, 12 Nov 2014 12:31:39 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.42.224.69 with SMTP id in5mr873031icb.19.1415824299466; Wed, 12 Nov 2014 12:31:39 -0800 (PST) Received: by 10.50.229.19 with HTTP; Wed, 12 Nov 2014 12:31:39 -0800 (PST) In-Reply-To: <883F2CBBC85A62419E181EB2F0ECF21F3E118128@US70UWXCHMBA04.zam.alcatel-lucent.com> References: <883F2CBBC85A62419E181EB2F0ECF21F3E1169F8@US70UWXCHMBA04.zam.alcatel-lucent.com> <1785488620.20141111221749@yandex.ru> <883F2CBBC85A62419E181EB2F0ECF21F3E118128@US70UWXCHMBA04.zam.alcatel-lucent.com> Date: Wed, 12 Nov 2014 20:31:00 -0000 Message-ID: Subject: Re: Can't Run Excel From A Cron Job Under Windows 7 From: Keith Christian To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2014-11/txt/msg00279.txt.bz2 Denis, If Excel is starting a macro in the worksheet, it might be worth adding some logging to the visual basic code. Perhaps try this in your Excel macro code if that is where the processing is taking place: '--- Set up variables near the top of your macro. '--- (Check whether you want the macro to set the current directory (ChDir strPath) to that of the workbook.) strPath =3D ThisWorkbook.Path ChDir strPath strLogFilename =3D strPath & "\" & "loggingfile.txt" '--- Insert this block at various areas in the macro code '--- Helps ensure logfile isn't discarded during a hang by '--- using "Append" mode and flushing/closing immediately after messages is written. Open strLogFilename For Append As #2 strLogMessage =3D Now & " ---- " & "Current directory is " & strPath Print #2, strLogMessage Close #2 Keith On Wed, Nov 12, 2014 at 9:20 AM, Kertz, Denis (D)** CTR ** wrote: >>> 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. >> >> Define "runs fine" please? >> What exactly that excel script is doing? > > This run.excel script simply starts up Excel with the .xls file it is giv= en. In this example Excel opens c:\Shared\Bin\Create_Daily_Scorecard.xls. = This .xls has a Workbook_Open macro, which is automatically run whenever t= his .xls is opened, that reads some data files and creates another .xls as = its output. > > What I mean by runs fine is that when I type this command at a bash promp= t: > run.excel 'c:\Shared\Bin\Create_Daily_Scorecard.xls' > it runs to completion and creates a new .xls as its output. When I run t= his run.excel script from a cron job it 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 proce= ss >>> but when I check 'Show processes from all users' it shows EXCEL.EXE run= ning >>> under user name Upar2 - a contradiction. >> >> Task manager display processes started in your current session. >> Not processes started under your credentials. That's an important differ= ence. > > Then this is just a difference between WinXP and Win7? Under WinXP it sh= ows EXCEL.EXE in my process list even when the "Show processes from all use= rs" isn't checked. > >>> 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. >> >> 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 li= mitations with using Excel from a cron job is Excel has to run error free. = If Excel does run into some error it will typically generate an error mess= age and wait for a user response. Since Excel is running invisibly from a = cron job, there is no user to give a response and Excel just sits there wai= ting for a response that will never come. > >>> 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, e= tc) >>> and see they are running with the ps command. But when I try to kill t= hem >>> (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. >> >> Of course. > > Why "of course"? Shouldn't I be able to kill my own processes? I can ce= rtainly do that under WinXP. But this isn't a major issue for me. I only = pointed it out in case it was related to the issue why my Excel cron jobs h= ang. > > -- >> WBR, >> Andrey Repin (anrdaemon@yandex.ru) 11.11.2014, <22:14> >> >> Sorry for my terrible english... > > Nothing wrong with your English... > > 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 > -- 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