public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Can't Run Excel From A Cron Job Under Windows 7
@ 2014-11-11 17:28 Kertz, Denis (D)** CTR **
  2014-11-11 19:20 ` Andrey Repin
  2014-12-22  0:05 ` Andrey Repin
  0 siblings, 2 replies; 12+ messages in thread
From: Kertz, Denis (D)** CTR ** @ 2014-11-11 17:28 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 2809 bytes --]

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.

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

[-- Attachment #2: cygcheck.out --]
[-- Type: application/octet-stream, Size: 29556 bytes --]


Cygwin Configuration Diagnostics
Current System Time: Tue Nov 11 16:03:02 2014

Windows 7 Professional Ver 6.1 Build 7601 Service Pack 1

Path:	C:\cygwin64\bin
	C:\cygwin64\usr\local\bin
	C:\cygwin64\bin
	C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services
	C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services
	C:\Program Files (x86)\Intel\iCLS Client
	C:\Program Files\Intel\iCLS Client
	C:\Windows\system32
	C:\Windows
	C:\Windows\System32\Wbem
	C:\Windows\System32\WindowsPowerShell\v1.0
	C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
	C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
	C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
	C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
	C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86
	C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64
	C:\cygwin64\home\Upar2\bin

Output from C:\cygwin64\bin\id.exe
UID: 1000(Upar2) GID: 513(None)
513(None)        545(Users)

SysDir: C:\Windows\system32
WinDir: C:\Windows

USER = 'Upar2'
PWD = '/home/Upar2'
HOME = '/home/Upar2'

USERDOMAIN_ROAMINGPROFILE = 'USNAVN0D011H46'
HOMEPATH = '\Users\Upar2'
APPDATA = 'C:\Users\Upar2\AppData\Roaming'
ProgramW6432 = 'C:\Program Files'
HOSTNAME = 'USNAVN0D011H46'
SHELL = '/bin/bash'
TERM = 'xterm'
PROCESSOR_IDENTIFIER = 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel'
PROFILEREAD = 'true'
WINDIR = 'C:\Windows'
PUBLIC = 'C:\Users\Public'
OLDPWD = '/home/Upar2/XIN'
ORIGINAL_PATH = '/cygdrive/c/Program Files/Common Files/Microsoft Shared/Microsoft Online Services:/cygdrive/c/Program Files (x86)/Common Files/Microsoft Shared/Microsoft Online Services:/cygdrive/c/Program Files (x86)/Intel/iCLS Client:/cygdrive/c/Program Files/Intel/iCLS Client:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files (x86)/Intel/OpenCL SDK/3.0/bin/x86:/cygdrive/c/Program Files (x86)/Intel/OpenCL SDK/3.0/bin/x64'
USERDOMAIN = 'USNAVN0D011H46'
CommonProgramFiles(x86) = 'C:\Program Files (x86)\Common Files'
UATDATA = 'C:\Windows\SysWOW64\CCM\UATData\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77'
OS = 'Windows_NT'
ALLUSERSPROFILE = 'C:\ProgramData'
windows_tracing_flags = '3'
windows_tracing_logfile = 'C:\BVTBin\Tests\installpackage\csilogfile.log'
TEMP = '/tmp'
DEFLOGDIR = 'C:\ProgramData\McAfee\DesktopProtection'
COMMONPROGRAMFILES = 'C:\Program Files\Common Files'
USERNAME = 'Upar2'
PROCESSOR_LEVEL = '6'
ProgramFiles(x86) = 'C:\Program Files (x86)'
PSModulePath = 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\'
FP_NO_HOST_CHECK = 'NO'
SYSTEMDRIVE = 'C:'
EDITOR = 'vi'
LANG = 'en_US.UTF-8'
USERPROFILE = 'C:\Users\Upar2'
CLIENTNAME = 'USNAVN0L047584'
TZ = 'America/Chicago'
PS1 = '$ '
LOGONSERVER = '\\USNAVN0D011H46'
CommonProgramW6432 = 'C:\Program Files\Common Files'
PROCESSOR_ARCHITECTURE = 'AMD64'
LOCALAPPDATA = 'C:\Users\Upar2\AppData\Local'
ProgramData = 'C:\ProgramData'
EXECIGNORE = '*.dll'
SHLVL = '1'
PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
HOMEDRIVE = 'C:'
COMSPEC = 'C:\Windows\system32\cmd.exe'
TMP = '/tmp'
SYSTEMROOT = 'C:\Windows'
PRINTER = 'Microsoft XPS Document Writer'
PROCESSOR_REVISION = '3c03'
INFOPATH = '/usr/local/info:/usr/share/info:/usr/info'
PROGRAMFILES = 'C:\Program Files'
NUMBER_OF_PROCESSORS = '4'
VSEDEFLOGDIR = 'C:\ProgramData\McAfee\DesktopProtection'
SESSIONNAME = 'RDP-Tcp#0'
COMPUTERNAME = 'USNAVN0D011H46'
_ = '/cygdrive/c/cygwin64/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygwin
HKEY_CURRENT_USER\Software\Cygwin\Installations
  (default) = '\??\C:\cygwin64'
HKEY_CURRENT_USER\Software\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\Installations
  (default) = '\??\C:\cygwin64'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\setup
  (default) = 'C:\cygwin64'
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cygwin\Installations
  (default) = '\??\C:\cygwin'
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Cygwin\setup
  (default) = 'C:\cygwin'

obcaseinsensitive set to 1

Cygwin installations found in the registry:
  System: Key: e022582115c10879 Path: C:\cygwin64
  User:   Key: e022582115c10879 Path: C:\cygwin64

c:  hd  NTFS    476710Mb  30% CP CS UN PA FC     
d:  cd             N/A    N/A                    

C:\cygwin64      /          system  binary,auto
C:\cygwin64\bin  /usr/bin   system  binary,auto
C:\cygwin64\lib  /usr/lib   system  binary,auto
cygdrive prefix  /cygdrive  user    binary,posix=0,auto

Found: C:\cygwin64\bin\awk
Found: C:\cygwin64\bin\awk
 -> C:\cygwin64\bin\gawk.exe
Found: C:\cygwin64\bin\bash.exe
Found: C:\cygwin64\bin\bash.exe
Found: C:\cygwin64\bin\cat.exe
Found: C:\cygwin64\bin\cat.exe
Found: C:\cygwin64\bin\cp.exe
Found: C:\cygwin64\bin\cp.exe
Found: C:\cygwin64\bin\cpp.exe
Found: C:\cygwin64\bin\cpp.exe
Found: C:\cygwin64\bin\crontab.exe
Found: C:\cygwin64\bin\crontab.exe
Found: C:\cygwin64\bin\find.exe
Found: C:\cygwin64\bin\find.exe
Found: C:\Windows\system32\find.exe
Warning: C:\cygwin64\bin\find.exe hides C:\Windows\system32\find.exe
Found: C:\cygwin64\bin\gcc.exe
Found: C:\cygwin64\bin\gcc.exe
Not Found: gdb
Found: C:\cygwin64\bin\grep.exe
Found: C:\cygwin64\bin\grep.exe
Found: C:\cygwin64\bin\kill.exe
Found: C:\cygwin64\bin\kill.exe
Found: C:\cygwin64\bin\ld.exe
Found: C:\cygwin64\bin\ld.exe
Found: C:\cygwin64\bin\ls.exe
Found: C:\cygwin64\bin\ls.exe
Found: C:\cygwin64\bin\make.exe
Found: C:\cygwin64\bin\make.exe
Found: C:\cygwin64\bin\mv.exe
Found: C:\cygwin64\bin\mv.exe
Not Found: patch
Found: C:\cygwin64\bin\perl.exe
Found: C:\cygwin64\bin\perl.exe
Found: C:\cygwin64\bin\rm.exe
Found: C:\cygwin64\bin\rm.exe
Found: C:\cygwin64\bin\sed.exe
Found: C:\cygwin64\bin\sed.exe
Found: C:\cygwin64\bin\ssh.exe
Found: C:\cygwin64\bin\ssh.exe
Found: C:\cygwin64\bin\sh.exe
Found: C:\cygwin64\bin\sh.exe
Found: C:\cygwin64\bin\tar.exe
Found: C:\cygwin64\bin\tar.exe
Found: C:\cygwin64\bin\test.exe
Found: C:\cygwin64\bin\test.exe
Found: C:\cygwin64\bin\vi.exe
Found: C:\cygwin64\bin\vi.exe
Found: C:\cygwin64\bin\vim.exe
Found: C:\cygwin64\bin\vim.exe

   38k 2013/07/19 C:\cygwin64\bin\cygargp-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygargp-0.dll" v0.0 ts=2013-07-19 15:07
   87k 2014/08/16 C:\cygwin64\bin\cygatomic-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygatomic-1.dll" v0.0 ts=2014-08-15 21:14
   16k 2013/03/26 C:\cygwin64\bin\cygattr-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygattr-1.dll" v0.0 ts=2013-03-26 18:26
  172k 2014/07/09 C:\cygwin64\bin\cygblkid-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygblkid-1.dll" v0.0 ts=1970-01-01 00:00
   64k 2013/03/07 C:\cygwin64\bin\cygbz2-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygbz2-1.dll" v0.0 ts=2013-03-07 02:54
  117k 2013/05/05 C:\cygwin64\bin\cygcloog-isl-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygcloog-isl-4.dll" v0.0 ts=2013-05-05 16:41
   12k 2014/06/09 C:\cygwin64\bin\cygcom_err-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygcom_err-2.dll" v0.0 ts=1970-01-01 00:00
    9k 2013/03/07 C:\cygwin64\bin\cygcrypt-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygcrypt-0.dll" v0.0 ts=2013-03-07 09:29
 1749k 2014/08/07 C:\cygwin64\bin\cygcrypto-1.0.0.dll - os=4.0 img=0.0 sys=5.2
                  "cygcrypto-1.0.0.dll" v0.0 ts=1970-01-01 00:00
 1526k 2013/03/08 C:\cygwin64\bin\cygdb-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb-5.3.dll" v0.0 ts=2013-03-08 07:55
  111k 2013/03/08 C:\cygwin64\bin\cygdb_cxx-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb_cxx-5.3.dll" v0.0 ts=2013-03-08 07:56
  472k 2013/03/08 C:\cygwin64\bin\cygdb_sql-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb_sql-5.3.dll" v0.0 ts=2013-03-08 07:58
  154k 2013/10/20 C:\cygwin64\bin\cygedit-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygedit-0.dll" v0.0 ts=2013-10-20 21:56
   22k 2013/05/12 C:\cygwin64\bin\cygffi-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygffi-6.dll" v0.0 ts=2013-05-12 22:53
   56k 2014/05/26 C:\cygwin64\bin\cygformw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygformw-10.dll" v0.0 ts=1970-01-01 00:00
   68k 2014/08/16 C:\cygwin64\bin\cyggcc_s-seh-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggcc_s-seh-1.dll" v0.0 ts=2014-08-15 20:40
   40k 2014/05/27 C:\cygwin64\bin\cyggdbm-4.dll - os=4.0 img=0.0 sys=5.2
                  "cyggdbm-4.dll" v0.0 ts=1970-01-01 00:00
   13k 2014/05/27 C:\cygwin64\bin\cyggdbm_compat-4.dll - os=4.0 img=0.0 sys=5.2
                  "cyggdbm_compat-4.dll" v0.0 ts=1970-01-01 00:00
  516k 2014/04/05 C:\cygwin64\bin\cyggmp-10.dll - os=4.0 img=0.0 sys=5.2
                  "cyggmp-10.dll" v0.0 ts=1970-01-01 00:00
   47k 2014/08/16 C:\cygwin64\bin\cyggomp-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggomp-1.dll" v0.0 ts=2014-08-15 20:43
  251k 2014/05/23 C:\cygwin64\bin\cyggssapi_krb5-2.dll - os=4.0 img=0.0 sys=5.2
                  "cyggssapi_krb5-2.dll" v0.0 ts=1970-01-01 00:00
   29k 2013/03/14 C:\cygwin64\bin\cyghistory7.dll - os=4.0 img=0.0 sys=5.2
                  "cyghistory7.dll" v0.0 ts=2013-03-14 11:14
  998k 2013/03/07 C:\cygwin64\bin\cygiconv-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygiconv-2.dll" v0.0 ts=2013-03-07 03:03
   38k 2014/06/16 C:\cygwin64\bin\cygintl-8.dll - os=4.0 img=0.0 sys=5.2
                  "cygintl-8.dll" v0.0 ts=1970-01-01 00:00
  888k 2013/05/05 C:\cygwin64\bin\cygisl-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygisl-10.dll" v0.0 ts=2013-05-05 16:36
  181k 2014/05/23 C:\cygwin64\bin\cygk5crypto-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygk5crypto-3.dll" v0.0 ts=1970-01-01 00:00
  700k 2014/05/23 C:\cygwin64\bin\cygkrb5-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygkrb5-3.dll" v0.0 ts=1970-01-01 00:00
   36k 2014/05/23 C:\cygwin64\bin\cygkrb5support-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygkrb5support-0.dll" v0.0 ts=1970-01-01 00:00
    6k 2014/08/13 C:\cygwin64\bin\cyglsa64.dll - os=4.0 img=0.0 sys=5.2
                  "cyglsa64.dll" v0.0 ts=2014-08-13 22:05
  129k 2014/05/29 C:\cygwin64\bin\cyglzma-5.dll - os=4.0 img=0.0 sys=5.2
                  "cyglzma-5.dll" v0.0 ts=1970-01-01 00:00
  106k 2014/07/01 C:\cygwin64\bin\cygmagic-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygmagic-1.dll" v0.0 ts=1970-01-01 00:00
  158k 2014/08/12 C:\cygwin64\bin\cygman-2-6-7.dll - os=4.0 img=0.0 sys=5.2
                  "cygman-2-6-7.dll" v0.0 ts=1970-01-01 00:00
   30k 2014/05/26 C:\cygwin64\bin\cygmenuw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygmenuw-10.dll" v0.0 ts=1970-01-01 00:00
   87k 2014/04/05 C:\cygwin64\bin\cygmpc-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygmpc-3.dll" v0.0 ts=1970-01-01 00:00
  319k 2013/05/05 C:\cygwin64\bin\cygmpfr-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygmpfr-4.dll" v0.0 ts=2013-05-05 13:40
   53k 2014/05/26 C:\cygwin64\bin\cygncurses++w-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygncurses++w-10.dll" v0.0 ts=1970-01-01 00:00
  299k 2014/05/26 C:\cygwin64\bin\cygncursesw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygncursesw-10.dll" v0.0 ts=1970-01-01 00:00
  207k 2014/03/13 C:\cygwin64\bin\cygp11-kit-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygp11-kit-0.dll" v0.0 ts=2014-03-13 03:35
   15k 2014/05/26 C:\cygwin64\bin\cygpanelw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygpanelw-10.dll" v0.0 ts=1970-01-01 00:00
  271k 2014/03/12 C:\cygwin64\bin\cygpcre-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpcre-1.dll" v0.0 ts=2014-03-12 02:35
 1580k 2013/03/11 C:\cygwin64\bin\cygperl5_14.dll - os=4.0 img=0.0 sys=5.2
                  "cygperl5_14.dll" v0.0 ts=2013-03-12 00:25
   38k 2014/05/12 C:\cygwin64\bin\cygpipeline-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpipeline-1.dll" v0.0 ts=1970-01-01 00:00
   41k 2013/10/21 C:\cygwin64\bin\cygpopt-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpopt-0.dll" v0.0 ts=2013-10-21 21:52
  303k 2014/08/16 C:\cygwin64\bin\cygquadmath-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygquadmath-0.dll" v0.0 ts=2014-08-15 21:12
  193k 2013/03/14 C:\cygwin64\bin\cygreadline7.dll - os=4.0 img=0.0 sys=5.2
                  "cygreadline7.dll" v0.0 ts=2013-03-14 11:14
  379k 2014/08/07 C:\cygwin64\bin\cygssl-1.0.0.dll - os=4.0 img=0.0 sys=5.2
                  "cygssl-1.0.0.dll" v0.0 ts=1970-01-01 00:00
   12k 2014/08/16 C:\cygwin64\bin\cygssp-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygssp-0.dll" v0.0 ts=2014-08-15 21:10
  892k 2014/08/16 C:\cygwin64\bin\cygstdc++-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygstdc++-6.dll" v0.0 ts=2014-08-15 20:51
   69k 2013/04/22 C:\cygwin64\bin\cygtasn1-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygtasn1-6.dll" v0.0 ts=2013-04-22 01:25
   53k 2014/05/26 C:\cygwin64\bin\cygticw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygticw-10.dll" v0.0 ts=1970-01-01 00:00
   14k 2014/07/09 C:\cygwin64\bin\cyguuid-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyguuid-1.dll" v0.0 ts=1970-01-01 00:00
   30k 2013/11/15 C:\cygwin64\bin\cygwrap-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygwrap-0.dll" v0.0 ts=2013-11-15 19:58
   79k 2013/05/09 C:\cygwin64\bin\cygz.dll - os=4.0 img=0.0 sys=5.2
                  "cygz.dll" v0.0 ts=2013-05-09 22:20
   24k 2013/05/30 C:\cygwin64\bin\cygzzip-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzip-0-13.dll" v0.0 ts=2013-05-30 03:34
   12k 2013/05/30 C:\cygwin64\bin\cygzzipfseeko-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipfseeko-0-13.dll" v0.0 ts=2013-05-30 03:34
   15k 2013/05/30 C:\cygwin64\bin\cygzzipmmapped-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipmmapped-0-13.dll" v0.0 ts=2013-05-30 03:34
    9k 2013/05/30 C:\cygwin64\bin\cygzzipwrap-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipwrap-0-13.dll" v0.0 ts=2013-05-30 03:34
 3083k 2014/08/13 C:\cygwin64\bin\cygwin1.dll - os=4.0 img=0.0 sys=5.2
                  "cygwin1.dll" v0.0 ts=1970-01-01 00:00
    Cygwin DLL version info:
        DLL version: 1.7.32
        DLL epoch: 19
        DLL old termios: 5
        DLL malloc env: 28
        Cygwin conv: 181
        API major: 0
        API minor: 274
        Shared data: 5
        DLL identifier: cygwin1
        Mount registry: 3
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Installations name: Installations
        Cygdrive default prefix: 
        Build date: 
        Shared id: cygwin1S5

   38k 2013/07/19 C:\cygwin64\bin\cygargp-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygargp-0.dll" v0.0 ts=2013-07-19 15:07
   87k 2014/08/16 C:\cygwin64\bin\cygatomic-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygatomic-1.dll" v0.0 ts=2014-08-15 21:14
   16k 2013/03/26 C:\cygwin64\bin\cygattr-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygattr-1.dll" v0.0 ts=2013-03-26 18:26
  172k 2014/07/09 C:\cygwin64\bin\cygblkid-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygblkid-1.dll" v0.0 ts=1970-01-01 00:00
   64k 2013/03/07 C:\cygwin64\bin\cygbz2-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygbz2-1.dll" v0.0 ts=2013-03-07 02:54
  117k 2013/05/05 C:\cygwin64\bin\cygcloog-isl-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygcloog-isl-4.dll" v0.0 ts=2013-05-05 16:41
   12k 2014/06/09 C:\cygwin64\bin\cygcom_err-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygcom_err-2.dll" v0.0 ts=1970-01-01 00:00
    9k 2013/03/07 C:\cygwin64\bin\cygcrypt-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygcrypt-0.dll" v0.0 ts=2013-03-07 09:29
 1749k 2014/08/07 C:\cygwin64\bin\cygcrypto-1.0.0.dll - os=4.0 img=0.0 sys=5.2
                  "cygcrypto-1.0.0.dll" v0.0 ts=1970-01-01 00:00
 1526k 2013/03/08 C:\cygwin64\bin\cygdb-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb-5.3.dll" v0.0 ts=2013-03-08 07:55
  111k 2013/03/08 C:\cygwin64\bin\cygdb_cxx-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb_cxx-5.3.dll" v0.0 ts=2013-03-08 07:56
  472k 2013/03/08 C:\cygwin64\bin\cygdb_sql-5.3.dll - os=4.0 img=0.0 sys=5.2
                  "cygdb_sql-5.3.dll" v0.0 ts=2013-03-08 07:58
  154k 2013/10/20 C:\cygwin64\bin\cygedit-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygedit-0.dll" v0.0 ts=2013-10-20 21:56
   22k 2013/05/12 C:\cygwin64\bin\cygffi-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygffi-6.dll" v0.0 ts=2013-05-12 22:53
   56k 2014/05/26 C:\cygwin64\bin\cygformw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygformw-10.dll" v0.0 ts=1970-01-01 00:00
   68k 2014/08/16 C:\cygwin64\bin\cyggcc_s-seh-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggcc_s-seh-1.dll" v0.0 ts=2014-08-15 20:40
   40k 2014/05/27 C:\cygwin64\bin\cyggdbm-4.dll - os=4.0 img=0.0 sys=5.2
                  "cyggdbm-4.dll" v0.0 ts=1970-01-01 00:00
   13k 2014/05/27 C:\cygwin64\bin\cyggdbm_compat-4.dll - os=4.0 img=0.0 sys=5.2
                  "cyggdbm_compat-4.dll" v0.0 ts=1970-01-01 00:00
  516k 2014/04/05 C:\cygwin64\bin\cyggmp-10.dll - os=4.0 img=0.0 sys=5.2
                  "cyggmp-10.dll" v0.0 ts=1970-01-01 00:00
   47k 2014/08/16 C:\cygwin64\bin\cyggomp-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyggomp-1.dll" v0.0 ts=2014-08-15 20:43
  251k 2014/05/23 C:\cygwin64\bin\cyggssapi_krb5-2.dll - os=4.0 img=0.0 sys=5.2
                  "cyggssapi_krb5-2.dll" v0.0 ts=1970-01-01 00:00
   29k 2013/03/14 C:\cygwin64\bin\cyghistory7.dll - os=4.0 img=0.0 sys=5.2
                  "cyghistory7.dll" v0.0 ts=2013-03-14 11:14
  998k 2013/03/07 C:\cygwin64\bin\cygiconv-2.dll - os=4.0 img=0.0 sys=5.2
                  "cygiconv-2.dll" v0.0 ts=2013-03-07 03:03
   38k 2014/06/16 C:\cygwin64\bin\cygintl-8.dll - os=4.0 img=0.0 sys=5.2
                  "cygintl-8.dll" v0.0 ts=1970-01-01 00:00
  888k 2013/05/05 C:\cygwin64\bin\cygisl-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygisl-10.dll" v0.0 ts=2013-05-05 16:36
  181k 2014/05/23 C:\cygwin64\bin\cygk5crypto-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygk5crypto-3.dll" v0.0 ts=1970-01-01 00:00
  700k 2014/05/23 C:\cygwin64\bin\cygkrb5-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygkrb5-3.dll" v0.0 ts=1970-01-01 00:00
   36k 2014/05/23 C:\cygwin64\bin\cygkrb5support-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygkrb5support-0.dll" v0.0 ts=1970-01-01 00:00
    6k 2014/08/13 C:\cygwin64\bin\cyglsa64.dll - os=4.0 img=0.0 sys=5.2
                  "cyglsa64.dll" v0.0 ts=2014-08-13 22:05
  129k 2014/05/29 C:\cygwin64\bin\cyglzma-5.dll - os=4.0 img=0.0 sys=5.2
                  "cyglzma-5.dll" v0.0 ts=1970-01-01 00:00
  106k 2014/07/01 C:\cygwin64\bin\cygmagic-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygmagic-1.dll" v0.0 ts=1970-01-01 00:00
  158k 2014/08/12 C:\cygwin64\bin\cygman-2-6-7.dll - os=4.0 img=0.0 sys=5.2
                  "cygman-2-6-7.dll" v0.0 ts=1970-01-01 00:00
   30k 2014/05/26 C:\cygwin64\bin\cygmenuw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygmenuw-10.dll" v0.0 ts=1970-01-01 00:00
   87k 2014/04/05 C:\cygwin64\bin\cygmpc-3.dll - os=4.0 img=0.0 sys=5.2
                  "cygmpc-3.dll" v0.0 ts=1970-01-01 00:00
  319k 2013/05/05 C:\cygwin64\bin\cygmpfr-4.dll - os=4.0 img=0.0 sys=5.2
                  "cygmpfr-4.dll" v0.0 ts=2013-05-05 13:40
   53k 2014/05/26 C:\cygwin64\bin\cygncurses++w-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygncurses++w-10.dll" v0.0 ts=1970-01-01 00:00
  299k 2014/05/26 C:\cygwin64\bin\cygncursesw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygncursesw-10.dll" v0.0 ts=1970-01-01 00:00
  207k 2014/03/13 C:\cygwin64\bin\cygp11-kit-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygp11-kit-0.dll" v0.0 ts=2014-03-13 03:35
   15k 2014/05/26 C:\cygwin64\bin\cygpanelw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygpanelw-10.dll" v0.0 ts=1970-01-01 00:00
  271k 2014/03/12 C:\cygwin64\bin\cygpcre-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpcre-1.dll" v0.0 ts=2014-03-12 02:35
 1580k 2013/03/11 C:\cygwin64\bin\cygperl5_14.dll - os=4.0 img=0.0 sys=5.2
                  "cygperl5_14.dll" v0.0 ts=2013-03-12 00:25
   38k 2014/05/12 C:\cygwin64\bin\cygpipeline-1.dll - os=4.0 img=0.0 sys=5.2
                  "cygpipeline-1.dll" v0.0 ts=1970-01-01 00:00
   41k 2013/10/21 C:\cygwin64\bin\cygpopt-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygpopt-0.dll" v0.0 ts=2013-10-21 21:52
  303k 2014/08/16 C:\cygwin64\bin\cygquadmath-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygquadmath-0.dll" v0.0 ts=2014-08-15 21:12
  193k 2013/03/14 C:\cygwin64\bin\cygreadline7.dll - os=4.0 img=0.0 sys=5.2
                  "cygreadline7.dll" v0.0 ts=2013-03-14 11:14
  379k 2014/08/07 C:\cygwin64\bin\cygssl-1.0.0.dll - os=4.0 img=0.0 sys=5.2
                  "cygssl-1.0.0.dll" v0.0 ts=1970-01-01 00:00
   12k 2014/08/16 C:\cygwin64\bin\cygssp-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygssp-0.dll" v0.0 ts=2014-08-15 21:10
  892k 2014/08/16 C:\cygwin64\bin\cygstdc++-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygstdc++-6.dll" v0.0 ts=2014-08-15 20:51
   69k 2013/04/22 C:\cygwin64\bin\cygtasn1-6.dll - os=4.0 img=0.0 sys=5.2
                  "cygtasn1-6.dll" v0.0 ts=2013-04-22 01:25
   53k 2014/05/26 C:\cygwin64\bin\cygticw-10.dll - os=4.0 img=0.0 sys=5.2
                  "cygticw-10.dll" v0.0 ts=1970-01-01 00:00
   14k 2014/07/09 C:\cygwin64\bin\cyguuid-1.dll - os=4.0 img=0.0 sys=5.2
                  "cyguuid-1.dll" v0.0 ts=1970-01-01 00:00
   30k 2013/11/15 C:\cygwin64\bin\cygwrap-0.dll - os=4.0 img=0.0 sys=5.2
                  "cygwrap-0.dll" v0.0 ts=2013-11-15 19:58
   79k 2013/05/09 C:\cygwin64\bin\cygz.dll - os=4.0 img=0.0 sys=5.2
                  "cygz.dll" v0.0 ts=2013-05-09 22:20
   24k 2013/05/30 C:\cygwin64\bin\cygzzip-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzip-0-13.dll" v0.0 ts=2013-05-30 03:34
   12k 2013/05/30 C:\cygwin64\bin\cygzzipfseeko-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipfseeko-0-13.dll" v0.0 ts=2013-05-30 03:34
   15k 2013/05/30 C:\cygwin64\bin\cygzzipmmapped-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipmmapped-0-13.dll" v0.0 ts=2013-05-30 03:34
    9k 2013/05/30 C:\cygwin64\bin\cygzzipwrap-0-13.dll - os=4.0 img=0.0 sys=5.2
                  "cygzzipwrap-0-13.dll" v0.0 ts=2013-05-30 03:34
 3083k 2014/08/13 C:\cygwin64\bin\cygwin1.dll - os=4.0 img=0.0 sys=5.2
                  "cygwin1.dll" v0.0 ts=1970-01-01 00:00
    Cygwin DLL version info:
        DLL version: 1.7.32
        DLL epoch: 19
        DLL old termios: 5
        DLL malloc env: 28
        Cygwin conv: 181
        API major: 0
        API minor: 274
        Shared data: 5
        DLL identifier: cygwin1
        Mount registry: 3
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Installations name: Installations
        Cygdrive default prefix: 
        Build date: 
        Shared id: cygwin1S5


Service             : cron                
Display name        : Cron daemon
Current State       : Running
Controls Accepted   : Stop
Command             : /usr/sbin/cron -n
stdin path          : /dev/null
stdout path         : /var/log/cron.log
stderr path         : /var/log/cron.log
Environment         : CYGWIN=" " 
Process Type        : Own Process
Startup             : Automatic
Account             : .\Upar2


Cygwin Package Information
Last downloaded files to: C:\cygwin64_packages
Last downloaded files from: http://mirrors.dotsrc.org/cygwin/

Package                  Version            Status
_autorebase              000203-1           OK
_update-info-dir         00307-1            OK
alternatives             1.3.30c-10         OK
base-cygwin              3.3-1              OK
base-files               4.2-3              OK
bash                     4.1.11-2           OK
binutils                 2.24.51-5          OK
bzip2                    1.0.6-2            OK
ca-certificates          1.97-2             OK
coreutils                8.23-2             OK
cron                     4.1-61             OK
crypt                    1.1-1              OK
csih                     0.9.7-1            OK
cygrunsrv                1.60-1             OK
cygutils                 1.4.14-1           OK
cygwin                   1.7.32-1           OK
cygwin-doc               1.7-1              OK
dash                     0.5.7-4            OK
diffutils                3.3-1              OK
dos2unix                 6.0.6-1            OK
editrights               1.02-1             OK
file                     5.19-1             OK
findutils                4.5.12-1           OK
gawk                     4.1.1-1            OK
gcc-core                 4.8.3-3            OK
gcc-g++                  4.8.3-3            OK
getent                   2.18.90-2          OK
grep                     2.16-1             OK
groff                    1.22.2-2           OK
gzip                     1.4-1              OK
hostname                 3.13-1             OK
ipc-utils                1.0-2              OK
less                     458-1              OK
libargp                  20110921-2         OK
libatomic1               4.8.3-3            OK
libattr1                 2.4.46-1           OK
libblkid1                2.24.2-1           OK
libbz2_1                 1.0.6-2            OK
libcloog-isl4            0.18.0-2           OK
libcom_err2              1.42.10-1          OK
libcrypt0                1.1-1              OK
libdb5.3                 5.3.21-1           OK
libedit0                 20130712-1         OK
libffi6                  3.0.13-1           OK
libgcc1                  4.8.3-3            OK
libgdbm4                 1.11-1             OK
libgmp10                 6.0.0a-1           OK
libgomp1                 4.8.3-3            OK
libgssapi_krb5_2         1.12.1-2           OK
libiconv2                1.14-1             OK
libintl8                 0.18.3.2-2         OK
libisl10                 0.11.1-2           OK
libk5crypto3             1.12.1-2           OK
libkrb5_3                1.12.1-2           OK
libkrb5support0          1.12.1-2           OK
liblzma5                 5.0.5-1            OK
libmpc3                  1.0.2-1            OK
libmpfr4                 3.1.2-1            OK
libncursesw10            5.9-20140524-1     OK
libopenssl100            1.0.1i-1           OK
libp11-kit0              0.20.2-1           OK
libpcre1                 8.34-1             OK
libpipeline1             1.3.0-3            OK
Empty package libpopt0
libpopt0                 1.16-1             OK
libquadmath0             4.8.3-3            OK
libreadline7             6.2-1              OK
libssp0                  4.8.3-3            OK
libstdc++6               4.8.3-3            OK
libtasn1_6               3.3-1              OK
libuuid1                 2.24.2-1           OK
libwrap0                 7.6-22             OK
libzzip0.13              0.13.62-1          OK
login                    1.10-10            OK
lynx                     2.8.7-2            OK
make                     4.0-2              OK
man-db                   2.6.7-2            OK
mintty                   1.2-beta1-1        OK
openssh                  6.6.1p1-3          OK
openssl                  1.0.1i-1           OK
p11-kit                  0.20.2-1           OK
p11-kit-trust            0.20.2-1           OK
perl                     5.14.4-1           OK
popt                     1.16-1             OK
rebase                   4.4.1-1            OK
run                      1.3.1-1            OK
sed                      4.2.2-3            OK
sharutils                4.14-1             OK
tar                      1.27.1-1           OK
terminfo                 5.9-20140524-1     OK
texinfo                  5.2-1              OK
tzcode                   2013c-1            OK
util-linux               2.24.2-1           OK
vim                      7.4.335-1          OK
vim-common               7.4.335-1          OK
vim-minimal              7.4.335-1          OK
w32api-headers           3.1.0-2            OK
w32api-runtime           3.1.0-1            OK
which                    2.20-2             OK
windows-default-manifest 6.3-1              OK
xxd                      7.4.335-1          OK
xz                       5.0.5-1            OK
zip                      3.0-12             OK
zlib0                    1.2.8-1            OK
zziplib                  0.13.62-1          OK
Use -h to see help about each section

[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-11 17:28 Can't Run Excel From A Cron Job Under Windows 7 Kertz, Denis (D)** CTR **
@ 2014-11-11 19:20 ` Andrey Repin
  2014-11-12 16:20   ` Kertz, Denis (D)** CTR **
  2014-12-22  0:05 ` Andrey Repin
  1 sibling, 1 reply; 12+ messages in thread
From: Andrey Repin @ 2014-11-11 19:20 UTC (permalink / raw)
  To: Kertz, Denis (D)** CTR **, cygwin

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.

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

Define "runs fine" please?
What exactly that excel script is doing?

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

Task manager display processes started in your current session.
Not processes started under your credentials. That's an important difference.

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

Of course.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 11.11.2014, <22:14>

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-11 19:20 ` Andrey Repin
@ 2014-11-12 16:20   ` Kertz, Denis (D)** CTR **
  2014-11-12 20:20     ` Andrey Repin
                       ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Kertz, Denis (D)** CTR ** @ 2014-11-12 16:20 UTC (permalink / raw)
  To: cygwin

>> 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 given.  In this example Excel opens c:\Shared\Bin\Create_Daily_Scorecard.xls.  This .xls has a Workbook_Open macro, which is automatically run whenever this .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 prompt:
	run.excel  'c:\Shared\Bin\Create_Daily_Scorecard.xls'
it runs to completion and creates a new .xls as its output.  When I run this 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 process
>> but when I check 'Show processes from all users' it shows EXCEL.EXE running
>> 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 difference.

Then this is just a difference between WinXP and Win7?  Under WinXP it shows EXCEL.EXE in my process list even when the "Show processes from all users" 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 limitations 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 message 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 waiting 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, 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.
>
> Of course.

Why "of course"?  Shouldn't I be able to kill my own processes?  I can certainly 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 hang.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-12 16:20   ` Kertz, Denis (D)** CTR **
@ 2014-11-12 20:20     ` Andrey Repin
  2014-11-13  1:22       ` Kertz, Denis (D)** CTR **
  2014-11-12 20:31     ` Keith Christian
  2014-11-18 22:49     ` Warren Young
  2 siblings, 1 reply; 12+ messages in thread
From: Andrey Repin @ 2014-11-12 20:20 UTC (permalink / raw)
  To: Kertz, Denis (D)** CTR **, cygwin

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

>>> 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
> given.  In this example Excel opens
> c:\Shared\Bin\Create_Daily_Scorecard.xls.  This .xls has a Workbook_Open
> macro, which is automatically run whenever this .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 prompt:
>         run.excel  'c:\Shared\Bin\Create_Daily_Scorecard.xls'
> it runs to completion and creates a new .xls as its output.  When I run
> this run.excel script from a cron job it hangs.

Hangs as in - do not create new file?

>>> 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.
>>
>> Task manager display processes started in your current session.
>> Not processes started under your credentials. That's an important difference.

> Then this is just a difference between WinXP and Win7?

It was the case in Vista already.

> Under WinXP it shows EXCEL.EXE in my process list even when the "Show
> processes from all users" isn't checked.

Only if you logged in as admin.

>>> 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
> limitations 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
> message 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
> waiting for a response that will never come.

Try starting cron in terminal session and see if anything comes up.

>>> 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.
>>
>> Of course.

> Why "of course"?  Shouldn't I be able to kill my own processes?

It's not "your own" process, it's "cron job" started with your credentials.

> I can certainly do that under WinXP.

Again, only if you logged in as admin.
This is not the case in Vista+ by default.

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


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 12.11.2014, <23:08>

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-12 16:20   ` Kertz, Denis (D)** CTR **
  2014-11-12 20:20     ` Andrey Repin
@ 2014-11-12 20:31     ` Keith Christian
  2014-11-18 22:49     ` Warren Young
  2 siblings, 0 replies; 12+ messages in thread
From: Keith Christian @ 2014-11-12 20:31 UTC (permalink / raw)
  To: cygwin

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 = ThisWorkbook.Path
ChDir strPath
strLogFilename = 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 = Now & " ---- " & "Current directory is " & strPath
Print #2, strLogMessage
Close #2



Keith


On Wed, Nov 12, 2014 at 9:20 AM, Kertz, Denis (D)** CTR **
<d.kertz@alcatel-lucent.com> 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 given.  In this example Excel opens c:\Shared\Bin\Create_Daily_Scorecard.xls.  This .xls has a Workbook_Open macro, which is automatically run whenever this .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 prompt:
>         run.excel  'c:\Shared\Bin\Create_Daily_Scorecard.xls'
> it runs to completion and creates a new .xls as its output.  When I run this 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 process
>>> but when I check 'Show processes from all users' it shows EXCEL.EXE running
>>> 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 difference.
>
> Then this is just a difference between WinXP and Win7?  Under WinXP it shows EXCEL.EXE in my process list even when the "Show processes from all users" 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 limitations 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 message 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 waiting 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, 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.
>>
>> Of course.
>
> Why "of course"?  Shouldn't I be able to kill my own processes?  I can certainly 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 hang.
>
> --
>> 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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-12 20:20     ` Andrey Repin
@ 2014-11-13  1:22       ` Kertz, Denis (D)** CTR **
  2014-11-13 22:35         ` Andrey Repin
  0 siblings, 1 reply; 12+ messages in thread
From: Kertz, Denis (D)** CTR ** @ 2014-11-13  1:22 UTC (permalink / raw)
  To: cygwin

>> What I mean by runs fine is that when I type this command at a bash prompt:
>>         run.excel  'c:\Shared\Bin\Create_Daily_Scorecard.xls'
>> it runs to completion and creates a new .xls as its output.  When I run
>> this run.excel script from a cron job it hangs.
>
> Hangs as in - do not create new file?

Hangs as in never finishes and I don't know what, if anything, it has done.  But that suggests some tests for me to run that I should have thought of.  First, create a test .xls that does nothing and see if that runs to completion.  If it does, then create a test .xls that simply creates a file to test whether it actually creates the file.

>> 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.
>> If Excel does run into some error it will typically generate an error
>> message 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
>> waiting for a response that will never come.
>
> Try starting cron in terminal session and see if anything comes up.

Can you tell me how to do this?  When I run the ps command in a terminal session, I see this:
$ ps
      PID    PPID    PGID     WINPID   TTY     UID    STIME COMMAND
     5780    5568    5780       3408  pty0    1000   Nov  5 /usr/bin/bash
     5568       1    5568       5568  ?       1000   Nov  5 /usr/bin/mintty
     3716    5780    3716       1016  pty0    1000 18:58:16 /usr/bin/ps
     1820       1    1820       1820  ?       1000   Nov  5 /usr/bin/cygrunsrv
     1856    1820    1856       1892  ?       1000   Nov  5 /usr/sbin/cron

Do I have to kill the cygrunsrv and cron processes and then ??

>> Why "of course"?  Shouldn't I be able to kill my own processes?
>
> It's not "your own" process, it's "cron job" started with your credentials.
>
>> I can certainly do that under WinXP.
>
> Again, only if you logged in as admin.
> This is not the case in Vista+ by default.

Okay, I think what you are telling me is that the login I'm using on "my" WinXP PC (which I inherited) must be an administrator login and the login I'm using on the Win7 PC is not an administrator login (it isn't).  That sounds plausible (I know a lot more about UNIX than I do about Windows).  So the differences I'm seeing between WinXP and Win7 is due to using/not using an administrator login, not due to whether it is WinXP or Win7.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-13  1:22       ` Kertz, Denis (D)** CTR **
@ 2014-11-13 22:35         ` Andrey Repin
  2014-11-18  1:36           ` Kertz, Denis (D)** CTR **
  0 siblings, 1 reply; 12+ messages in thread
From: Andrey Repin @ 2014-11-13 22:35 UTC (permalink / raw)
  To: Kertz, Denis (D)** CTR **, cygwin

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

>>> What I mean by runs fine is that when I type this command at a bash prompt:
>>>         run.excel  'c:\Shared\Bin\Create_Daily_Scorecard.xls'
>>> it runs to completion and creates a new .xls as its output.  When I run
>>> this run.excel script from a cron job it hangs.
>>
>> Hangs as in - do not create new file?

> Hangs as in never finishes and I don't know what, if anything, it has done.
> But that suggests some tests for me to run that I should have thought of. 
> First, create a test .xls that does nothing and see if that runs to
> completion.  If it does, then create a test .xls that simply creates a file
> to test whether it actually creates the file.

:)

>>> 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.
>>> If Excel does run into some error it will typically generate an error
>>> message 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
>>> waiting for a response that will never come.
>>
>> Try starting cron in terminal session and see if anything comes up.

> Can you tell me how to do this?  When I run the ps command in a terminal session, I see this:
> $ ps
>       PID    PPID    PGID     WINPID   TTY     UID    STIME COMMAND
>      5780    5568    5780       3408  pty0    1000   Nov  5 /usr/bin/bash
>      5568       1    5568       5568  ?       1000   Nov  5 /usr/bin/mintty
>      3716    5780    3716       1016  pty0    1000 18:58:16 /usr/bin/ps
>      1820       1    1820       1820  ?       1000   Nov  5 /usr/bin/cygrunsrv
>      1856    1820    1856       1892  ?       1000   Nov  5 /usr/sbin/cron

> Do I have to kill the cygrunsrv and cron processes and then ??

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.

>>> Why "of course"?  Shouldn't I be able to kill my own processes?
>>
>> It's not "your own" process, it's "cron job" started with your credentials.
>>
>>> I can certainly do that under WinXP.
>>
>> Again, only if you logged in as admin.
>> This is not the case in Vista+ by default.

> Okay, I think what you are telling me is that the login I'm using on "my"
> WinXP PC (which I inherited) must be an administrator login

By default, the first user account created after system installation
(rid:1000), have admin rights. In any system, starting from Win2000.
However, WinXP has no concept of privilege escalation, and if you've had admin
rights, you were always working with them enabled.

> and the login
> I'm using on the Win7 PC is not an administrator login (it isn't).  That
> sounds plausible (I know a lot more about UNIX than I do about Windows).

Then just think as if you've been running as root in WinXP, but now, you're
running as user with access to sudo facility under Win7. This is not entirely
correct, but close enough to give you an idea.

> So
> the differences I'm seeing between WinXP and Win7 is due to using/not using
> an administrator login, not due to whether it is WinXP or Win7.

The difference is inherently architectural, and not directly related to using
or not using admin account.
I think we best keep discussion strictly relevant to your present issue.
If you want any more details on Win7 security "improvements", google "UAC
description".


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 14.11.2014, <01:14>

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-13 22:35         ` Andrey Repin
@ 2014-11-18  1:36           ` Kertz, Denis (D)** CTR **
  2014-11-19 13:50             ` Andrey Repin
  0 siblings, 1 reply; 12+ messages in thread
From: Kertz, Denis (D)** CTR ** @ 2014-11-18  1:36 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-12 16:20   ` Kertz, Denis (D)** CTR **
  2014-11-12 20:20     ` Andrey Repin
  2014-11-12 20:31     ` Keith Christian
@ 2014-11-18 22:49     ` Warren Young
  2 siblings, 0 replies; 12+ messages in thread
From: Warren Young @ 2014-11-18 22:49 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-18  1:36           ` Kertz, Denis (D)** CTR **
@ 2014-11-19 13:50             ` Andrey Repin
  0 siblings, 0 replies; 12+ messages in thread
From: Andrey Repin @ 2014-11-19 13:50 UTC (permalink / raw)
  To: Kertz, Denis (D)** CTR **, cygwin

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

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

runas supply a plentiful help page when started without any parameters.
Your problem is probably that you assume the mintty to be the way to go, or
sort of a requirement, which it isn't.
runas is a windows tool to start applications under different credentials. And
as any native tool, it has no concept of pty's, and unlikely to output
anything to the mintty.
You can overcome this with redirection to an extent, i.e.
runas | iconv -f <OEM_encoding>

> 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

cygstart is a cygwin analogue for START command. Not the tool for the job.


--
WBR,
Andrey Repin (anrdaemon@yandex.ru) 19.11.2014, <16:19>

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-11-11 17:28 Can't Run Excel From A Cron Job Under Windows 7 Kertz, Denis (D)** CTR **
  2014-11-11 19:20 ` Andrey Repin
@ 2014-12-22  0:05 ` Andrey Repin
  2015-01-12 16:51   ` Kertz, Denis (D)** CTR **
  1 sibling, 1 reply; 12+ messages in thread
From: Andrey Repin @ 2014-12-22  0:05 UTC (permalink / raw)
  To: Kertz, Denis (D)** CTR **, cygwin

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@yandex.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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Can't Run Excel From A Cron Job Under Windows 7
  2014-12-22  0:05 ` Andrey Repin
@ 2015-01-12 16:51   ` Kertz, Denis (D)** CTR **
  0 siblings, 0 replies; 12+ messages in thread
From: Kertz, Denis (D)** CTR ** @ 2015-01-12 16:51 UTC (permalink / raw)
  To: cygwin

After more investigation, I agree that this isn't a cywin problem but this isn't a GUI issue either.  Something very strange is going on.

Here is a test vb script to control Excel using the wscript engine (c:/Windows/System32/wscript.exe).  This vb script simply starts Excel, opens a .csv file (c:\Shared\Prospect\Bin\test.csv), and terminates:

	Dim xlApp
	Dim xlWb

	Set xlApp = CreateObject("Excel.application")
	xlApp.Visible = True
	Set xlWb = xlApp.workbooks.Open("c:\Shared\Prospect\Bin\test.csv")
	xlApp.Quit
	Set xlWb = Nothing
	Set xlApp = Nothing

Here is the cron job to run this vb script:

	c:/Windows/System32/wscript.exe "c:\cygwin64\home\Upar2\bin\testExcel.vbs"

When this cron job is run, it hangs with Excel running (and doing nothing).

However, if the line that opens the .csv file is removed from this script:
	Set xlWb = xlApp.workbooks.Open("c:\Shared\Prospect\Bin\test.csv")
Then the script runs successfully.  That shows the cron job is running successfully for this trivial Excel program that simply starts Excel and terminates Excel.

This suggests there is a permission issue with opening the test.csv file but that isn't the case.  A cron job was run to simply cat the test.csv file and this works:

	cat  c:/Shared/Prospect/Bin/test.csv  >$HOME/cat.out

Finally, as was previously suggested, this script was executed using the runas command and that works successfully:

	runas  /user:<PC name>\Upar2  "c:\Windows\System32\wscript.exe  c:\cygwin64\home\Upar2\bin\testExcel.vbs"

A variation of this Excel script was created to create a new workbook (xlApp.Workbooks.Add) and save the workbook as a .xls file.  This also results in Excel hanging when run as a cron job.

So it appears the Excel script runs successfully as a cron job as long as no file operation (read or write) is performed which, of course, means no useful Excel script can be run.

Any ideas?

Denis

-----Original Message-----
From: Andrey Repin [mailto:anrdaemon@yandex.ru] 
Sent: Sunday, December 21, 2014 6:03 PM
To: Kertz, Denis (D)** CTR **; cygwin@cygwin.com
Subject: [SPAM?] Re: Can't Run Excel From A Cron Job Under Windows 7

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@yandex.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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-01-12 16:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-11 17:28 Can't Run Excel From A Cron Job Under Windows 7 Kertz, Denis (D)** CTR **
2014-11-11 19:20 ` Andrey Repin
2014-11-12 16:20   ` Kertz, Denis (D)** CTR **
2014-11-12 20:20     ` Andrey Repin
2014-11-13  1:22       ` Kertz, Denis (D)** CTR **
2014-11-13 22:35         ` Andrey Repin
2014-11-18  1:36           ` Kertz, Denis (D)** CTR **
2014-11-19 13:50             ` Andrey Repin
2014-11-12 20:31     ` Keith Christian
2014-11-18 22:49     ` Warren Young
2014-12-22  0:05 ` Andrey Repin
2015-01-12 16:51   ` Kertz, Denis (D)** CTR **

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).