This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cron run task can not see samba mounts.


I have a cronjob setup so that I can backup several files from the
windows local fs to folders on one of my samba shares which is mounted
on my windows machine. I setup cron as a windows service using the
following as a guide
http://www.cygwin.com/ml/cygwin/2002-01/msg01940.html. The cronjob
worked for a while. I can't say for sure when it stopped working but I
first noticed it somewhere around when I changed the IP of my samba
server. The cronjob currently can not see  the samba share. I have the
cronjob setup as a shell script, which I've added diagnostics to to
try and figure out what is wrong. I have rebooted my windows machine
several times to see if that helps any, it has not. The following is
the current iteration of the shell script:

#!/usr/bin/bash

echo "" >> /home/Mike/rsync.log
date >> /home/Mike/rsync.log
whoami >> /home/Mike/rsync.log 2>&1
env >> /home/Mike/rsync.log 2>&1
mkdir /mnt >> /home/Mike/rsync.log 2>&1
mkdir /mnt/z >> /home/Mike/rsync.log 2>&1
mount z: /mnt/z >> /home/Mike/rsync.log 2>&1
df >> /home/Mike/rsync.log 2>&1
nice -19 rsync -au /cygdrive/c/Documents\ and\ Settings/Mike/
/mnt/z/backup/c/Documents\ and\ Settings/Mike/ >> /home/Mike/rsync.log
2>&1
nice -19 rsync -au /cygdrive/g/Photos/ /mnt/z/backup/g/Photos/ >>
/home/Mike/rsync.log 2>&1
nice -19 rsync -au /cygdrive/g/Temp/ /mnt/z/backup/g/Temp/ >>
/home/Mike/rsync.log 2>&1
nice -19 rsync -au /cygdrive/g/Desktop\ Extension/
/mnt/z/backup/g/Desktop\ Extension/ >> /home/Mike/rsync.log 2>&1
umount /mnt/z

Below is the output when run from cron as the following crontab entry:

1-59 * * * * nohup /home/Mike/rsync.sh &

Sun Feb 18 18:55:02 EST 2007
Mike
ALLUSERSPROFILE=C:\Documents and Settings\All Users
CLASSPATH="C:\Program Files\Java\j2re1.4.2_01\lib\ext\QTJava.zip"
COMMONPROGRAMFILES=C:\Program Files\Common Files
COMPUTERNAME=ZWEI
COMSPEC=C:\WINDOWS\system32\cmd.exe
CYGWIN=ntsec
DEFAULT_CA_NR=CA6
HOME=/home/Mike
HOMEDRIVE=F:
HOMEPATH=\cygwin\home\Mike
LOGNAME=Mike
LOGONSERVER=\\ZWEI
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
PATH=/imagemagick-6.0.0-q16:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/Program
Files/Common Files/Adaptec Shared/System:/cygdrive/f/
Program Files/Executive Software/Diskeeper/:/cygdrive/c/Program
Files/Common Files/Teleca Shared:/cygdrive/c/Program Files/Common
Files/Roxio Shared/DLLShared:/bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 5 Stepping 8, AuthenticAMD
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0508
PROGRAMFILES=C:\Program Files
PWD=/home/Mike
QTJAVA="C:\Program Files\Java\j2re1.4.2_01\lib\ext\QTJava.zip"
SHELL=/bin/sh
SHLVL=1
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINDOWS
TEMP=/cygdrive/c/WINDOWS/TEMP
TERM=cygwin
TMP=/cygdrive/c/WINDOWS/TEMP
TZ=EST5EDT4,M4.1.0/2,M10.5.0/2
USERDOMAIN=ZWEI
USERNAME=Mike
USERPROFILE=C:\Documents and Settings\Mike
WINDIR=C:\WINDOWS
_=/bin/env
mkdir: cannot create directory `/mnt': File exists
mkdir: cannot create directory `/mnt/z': No such file or directory
mount: /mnt/z: Device or resource busy
Filesystem           1K-blocks      Used Available Use% Mounted on
F:\Program Files\NX Client for Windows\usr\X11R6\lib\X11\fonts
                    103635280  93394188  10241092  91% /mnt/NX/fonts
C:\Documents and Settings\Mike\.nx\tmp
                     13582924  10920904   2662020  81% /tmp
F:\Program Files\NX Client for Windows
                    103635280  93394188  10241092  91% /usr/NX
F:\cygwin\usr\X11R6\lib\X11\fonts
                    103635280  93394188  10241092  91% /usr/X11R6/lib/X11/fonts
F:\cygwin\bin        103635280  93394188  10241092  91% /usr/bin
F:\cygwin\lib        103635280  93394188  10241092  91% /usr/lib
F:\cygwin            103635280  93394188  10241092  91% /
df: `/mnt/z': No such file or directory
c:                    13582924  10920904   2662020  81% /cygdrive/c
f:                   103635280  93394188  10241092  91% /cygdrive/f
g:                   117218240  49112440  68105800  42% /cygdrive/g
h:                     3835684   3835684         0 100% /cygdrive/h
rsync: mkdir "/mnt/z/backup/c/Documents and Settings/Mike" failed: No
such file or directory (2)
rsync error: error in file IO (code 11) at
/home/lapo/packaging/tmp/rsync-2.6.3/main.c(381)
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at
/home/lapo/packaging/tmp/rsync-2.6.3/io.c(359)
rsync: mkdir "/mnt/z/backup/g/Photos" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at
/home/lapo/packaging/tmp/rsync-2.6.3/main.c(381)
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at
/home/lapo/packaging/tmp/rsync-2.6.3/io.c(359)
rsync: mkdir "/mnt/z/backup/g/Temp" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at
/home/lapo/packaging/tmp/rsync-2.6.3/main.c(381)
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at
/home/lapo/packaging/tmp/rsync-2.6.3/io.c(359)
rsync: mkdir "/mnt/z/backup/g/Desktop Extension" failed: No such file
or directory (2)
rsync error: error in file IO (code 11) at
/home/lapo/packaging/tmp/rsync-2.6.3/main.c(381)
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at
/home/lapo/packaging/tmp/rsync-2.6.3/io.c(359)

Here is the output when I run the command manually from a xcygwin xterm:

[Mike@ZWEI ~]$ nohup /home/Mike/rsync.sh &

Sun Feb 18 18:58:53 EST 2007
Mike
!C:=C:\Documents and Settings\Mike\Desktop
!F:=F:\cygwin\bin
ALLUSERSPROFILE=C:\Documents and Settings\All Users
APPDATA=C:\Documents and Settings\Mike\Application Data
CLASSPATH="C:\Program Files\Java\j2re1.4.2_01\lib\ext\QTJava.zip"
CLIENTNAME=Console
COMMONPROGRAMFILES=C:\Program Files\Common Files
COMPUTERNAME=ZWEI
COMSPEC=C:\WINDOWS\system32\cmd.exe
CVS_RSH=/bin/ssh
DEFAULT_CA_NR=CA6
DISPLAY=:0.0
HOME=/home/Mike
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Mike
HOSTNAME=ZWEI
INFOPATH=/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/info:/usr/autotool/stable/info:/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/info:/usr/autotool/s
table/info:
LOGNAME=Mike
LOGONSERVER=\\ZWEI
MAKE_MODE=unix
MANPATH=/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man:/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man::/usr/ssl/man:/usr/X11R6/man:/usr/ssl/man:/usr/X11
R6/man
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/imagemagick-6.0.0-q16:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS
/System32/Wbem:/cygdrive/c/Program Files/Common Files/Adaptec
Shared/System:/cygdrive/f/Program Files/Executive
Software/Diskeeper/:/cygdrive/c/Program Files/Common Files/Teleca
Shared
:/cygdrive/c/Program Files/Common Files/Roxio
Shared/DLLShared:/cygdrive/f/Program Files/SSH Communications
Security/SSH Secure Shell
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 5 Stepping 8, AuthenticAMD
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=0508
PROGRAMFILES=C:\Program Files
PROMPT=$P$G
PWD=/home/Mike
QTJAVA="C:\Program Files\Java\j2re1.4.2_01\lib\ext\QTJava.zip"
SESSIONNAME=Console
SHLVL=4
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINDOWS
TEMP=/cygdrive/c/DOCUME~1/Mike/LOCALS~1/Temp
TERM=xterm
TERMCAP=xterm-r6|xterm|xterm X11R6
version:am:km:mi:ms:xn:co#80:it#8:li#24:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:ce=\E
[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:im=\E[4h:is=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS
:k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kd=\EOB:ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:md=\E[1m:me=\E[m:mr=\E[7
m:nd=\E[C:rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[m:up=\E[A:us=\E[4m:kb=\010:
TEXMF={/usr/share/lilypond/2.4.2,/usr/share/texmf}
TMP=/cygdrive/c/DOCUME~1/Mike/LOCALS~1/Temp
USER=Mike
USERDOMAIN=ZWEI
USERNAME=Mike
USERPROFILE=C:\Documents and Settings\Mike
WINDIR=C:\WINDOWS
WINDOWID=12582926
XAPPLRESDIR=/usr/X11R6/lib/X11/app-defaults
XAUTHORITY=/home/Mike/.Xauthority
XCMSDB=/usr/X11R6/lib/X11/Xcms.txt
XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
XNLSPATH=/usr/X11R6/lib/X11/locale
_=/usr/bin/env
mkdir: cannot create directory `/mnt': File exists
mkdir: cannot create directory `/mnt/z': File exists
mount: defaulting to '--no-executable' flag for speed since native path
      references a remote share.  Use '-f' option to override.
Filesystem           1K-blocks      Used Available Use% Mounted on
F:\Program Files\NX Client for Windows\usr\X11R6\lib\X11\fonts
                    103635280  93394196  10241084  91% /mnt/NX/fonts
C:\Documents and Settings\Mike\.nx\tmp
                     13582924  10921348   2661576  81% /tmp
F:\Program Files\NX Client for Windows
                    103635280  93394196  10241084  91% /usr/NX
F:\cygwin\usr\X11R6\lib\X11\fonts
                    103635280  93394196  10241084  91% /usr/X11R6/lib/X11/fonts
F:\cygwin\bin        103635280  93394196  10241084  91% /usr/bin
F:\cygwin\lib        103635280  93394196  10241084  91% /usr/lib
F:\cygwin            103635280  93394196  10241084  91% /
z:                   235332176 119905272 115426904  51% /mnt/z
b:                   235332176 119905272 115426904  51% /cygdrive/b
c:                    13582924  10921348   2661576  81% /cygdrive/c
f:                   103635280  93394196  10241084  91% /cygdrive/f
g:                   117218240  49112440  68105800  42% /cygdrive/g
h:                     3835684   3835684         0 100% /cygdrive/h

As you can see, when I run the command manually from a xcygwin xterm
the script has no issues seeing z: mounted at /mnt/z. No such luck
when the script is run from cron. I notice some subtle differences in
the env but I can't explain why the samba share would not appear from
the cron...

Anyone else ever have similar issues with cron's env? Any advice would
be much appreciated otherwise I'll have to setup rsync to use ssh I
suppose...

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]