Thank you very much Larry!
I'll try! Your message is very clear.
Bye
Christian
(I'm very satisfied with CYGWIN, great job!)
- Original Message -
From: Larry Hall (Cygwin) [EMAIL PROTECTED]
To: Christian Lanconelli (servizio) [EMAIL PROTECTED]
Cc: cygwin@cygwin.com
Sent: Sunday, January 08, 2006 9:11 AM
Subject: Re: help cron cygwin
Christian Lanconelli (servizio) wrote:
Hi,
CRON can run commands wrote in fortran containing the call system()
statement?
this is my program : trasf_DOS.f
It write a DOS batch file that is immediately run by the 'call system
(copio.bat)' statement-
It WORK WELL in the bash shell (cygwin because I use the DOS commands
xcopy)
but can't run as a cron scheduled job.
Both trasf_DOS.exe, and copio.bat, are in the $PATH.
1) IT WORKS NORMALLY:
[EMAIL PROTECTED] /cygdrive/c/cvi/ICARO/dati
$ ./trasf_DOS.exe Carriage Return
sab 07/01/2006
Prima della trasformazione: 7 1 2006
Dopo la trasformazione: 6 1 6
=== Copio i file lanciando il batch appena creato ===
c:\cvi\ICARO\datixcopy c:\cvi\ICARO\dati\??060106.* \\pc27\CO2_O3\ /D
/F
/Z
C:\cvi\ICARO\dati\DD060106.GAS - \\pc27\CO2_O3\DD060106.GAS
C:\cvi\ICARO\dati\DD060106.MET - \\pc27\CO2_O3\DD060106.MET
C:\cvi\ICARO\dati\DD060106.RAD - \\pc27\CO2_O3\DD060106.RAD
C:\cvi\ICARO\dati\MN060106.DEU - \\pc27\CO2_O3\MN060106.DEU
C:\cvi\ICARO\dati\MN060106.GAS - \\pc27\CO2_O3\MN060106.GAS
C:\cvi\ICARO\dati\MN060106.MET - \\pc27\CO2_O3\MN060106.MET
C:\cvi\ICARO\dati\MN060106.RAD - \\pc27\CO2_O3\MN060106.RAD
7 File copiati
(end of trasf_DOS.exe)
2) IT IS IN THE PATH
[EMAIL PROTECTED] /cygdrive/c/cvi/ICARO/dati
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/c/WINNT/system32:/cygd
rive
/c/WINNT:/cygdrive/c/VXIPNP/WinNT/Bin:/cygdrive/c/cvi/icaro/dati
3) Here are the crontab -l output:
[EMAIL PROTECTED] /cygdrive/c/cvi/ICARO/dati
$ crontab -l
40 * * * * trasf_DOS.exe;echo tab eseguito alle
$(date)/home/Administrator/cronlog
The file cronlog is regularly updated. But trasf_DOS appears not work!
Can you help me? What's my error?
It's a common cron misconception that occurs across all platforms on
which it runs. The fact that a script runs when logged in but not in cron
suggests that it is a path issue. Don't assume the path is right. Don't
assume that things cron runs will have exactly the same environment you
have on the command line. Write defensively scripts/apps that cron will
run.
In this case, providing the fully qualified path to your executable and
copio.bat when they are invoked should help. Keep in mind as well that
Cygwin compiled programs are going to invoke Cygwin's system(), not
Windows,
and that .bat files aren't going to be interpreted properly by any Cygwin
shell. So you'll probably want to invoke a fully qualified command.com
or cmd.exe as part of your system() call, depending on your target
platform.
--
Larry Hall http://www.rfk.com
RFK Partners, Inc. (508) 893-9779 - RFK Office
838 Washington Street (508) 893-9889 - FAX
Holliston, MA 01746
begin 666 100_3935.JPG
M_]C_X `02D9)[EMAIL PROTECTED]@[EMAIL PROTECTED]@[EMAIL PROTECTED]0$/``(`
M```6@$0``([EMAIL PROTECTED],!``$```$:[EMAIL PROTECTED];
[EMAIL PROTECTED],!``(```$Q``(0Z@(3``,!``(`
M`([EMAIL PROTECTED]3!%05-434%.($M/1$%+($-/35!!3ED`
[EMAIL PROTECTED]@W,S$P($1)
[EMAIL PROTECTED])!``#F`0```.8!5F5RVEO
M;B R+C P,# @
M
M__\`)8*:``4!```#/(*=``4!```#1(@B``,!``(`
M`(@G``,!`0``) ```$,#(R,) #``(4```#%) $``(4
M```#*)$!``$`0(#`)$``4!```#3)(!``H!```#5)(``4`
M```!```#7)($``H!```#9)(%``4!```#;)('``,!``(``)()
M``,[EMAIL PROTECTED])(*``4!```#=))\`/$```#C* ```$,#$P
M,* !``,!``$``* ``0!```((* #``0!```* %``0!
M```)UJ(5``4!```#?*(7``,!``(``*,```!`P```*,!```
M```!`0```*0!``,!`*0``,!`*0#``,!`*0$
M``4!```#A*0%``,!`4``*0``,!`*0'``,!
M`*0(``,!`*0)``,!`*0*``,!`*0,``,!
M```R,# V.C Q.C T(#$U.C0U.C4S`#(P,#8Z,#$Z,#0@,34Z-#4Z
M-3,!LP`/0D ```'9 [EMAIL PROTECTED] ```0```Q9 ``
M```*```!L0```0```).9 ```0!``I#6#S,5DX
M.#8S,C4P`T`80!N` `2P!O`0`80`Y_ ```NW``$!2UX``$!1
M*P```G([EMAIL PROTECTED]0`9 ```0$!W* `
M`0%6@ `#$!`@ '`([EMAIL PROTECTED] `D@7`)L`DP3`(0`:0!Q`(`B #
M`'[EMAIL PROTECTED](`: !H`%T``0`!`/[EMAIL PROTECTED]``'__P``__\``P`#``(`
M```!``$`! `#``0``P`#``,`' `;`!P`'0`` `# `,``P`#P`-`! ``P`#
[EMAIL PROTECTED]@ `( `@ `( `@ `( `@ `( `
M@ `( `@ `( `@ `( `@ `( `_P#-`/\`_P#_`/\`_PT`/\`,@`2
M`([EMAIL PROTECTED])0`04`/\`N0#_`'0`) `=`'D``_ BI `
M