Cron problem/Documentation and Setup

Andrew DeFaria Andrew@DeFaria.com
Thu Aug 19 02:51:00 GMT 2004


Igor Pechtchanski wrote:

> On Wed, 18 Aug 2004, Andrew DeFaria wrote:
>
>> Larry Hall wrote:
>>
>>> At 09:39 PM 8/17/2004, you wrote:
>>>
>>>> I'm having a problem with cron in this new environment. I cannot 
>>>> execute
>>>> any of my own scripts in my ~/bin. I was also having problems executing
>>>> even things in /tmp!
>>>>
>>>> [snip]
>>>>
>>>> As for my cron problem I can execute rudimentary commands such as 
>>>> ls, pwd
>>>> and redirect the output to /tmp/debug.log. From that I can see that pwd
>>>> tells me that I'm in /var/cron. The script I want to execute is under
>>>> ~/bin (which is on a network share). I copied that script to /tmp and
>>>> insured that it was set 777. Then I performed the following cron jobs:
>>>>
>>>> 18 17 * * * pwd >> /tmp/debug.log 2>&1
>>>> 19 17 * * * ls >> /tmp/debug.log 2>&1
>>>> 20 17 * * * ls -l /tmp/myscript >> /tmp/debug.log 2>&1
>>>> 21 17 * * * /tmp/myscript >> /tmp/debug.log 2>&1
>>>>
>>>> Here's the result:
>>>>
>>>> /var/cron
>>>> tabs
>>>> -rwxrwxrwx 1 TPAD3741 Domain U 5201 Aug 17 17:15 /tmp/myscript
>>>>
>>>> /tmp/myscript never get's executed.
>>>
>>> Sorry, can't really help here. There's just not enough information about
>>> what your script does or what your environment for me to hazard a guess.
>>> If you post more details or, better yet, a small test case, I can 
>>> try it.
>>> The simple test I did which just echos "Hello World" from a bash script
>>> worked fine for me.
>>
>> Well initially it was a Perl script that I'm trying to run through cron.
>> But I then stripped it down to just:
>>
>> #!/bin/bash
>> echo "testme" >> /tmp/debug.log 2>&1
>>
>> Nothing additional got written into /tmp/debug.log.
>
> You have, of course, reviewed

Yes I have but there was nothing there. Changed myscript to echo to 
/tmp/myscript.log so as not to have any problems with other things 
writing to /tmp/debug.log. No /tmp/myscript.log file was created.

>> Problem reports: http://cygwin.com/problems.html
>
> and thought of attaching the output of "cygcheck -svr", right?

Yeah I thought about it! :-)

OK I've attached it....

> Also, did  you try "cron_diagnose.sh" (Google for it)?
>
> I suspect some or all of your mounts may not be visible to cron... 

cron_diagnose.sh did point out that my /etc/passwd and /etc/group lacked 
read permission! Well it didn't actually lack read permission rather it 
was a symlink to network share. Actually it was a mount to a network 
share. So apparently I can't link passwd and group (I know, I know you 
hardliners will say "You shouldn't symlink such things to network 
locations! What happens if the network is down and you try to login?" - 
well I'm already logged into Windows so there is no real login happening 
under Cygwin. Yes there is a risk if the network is down then I will not 
have passwd, group, etc. Then again, whenever the network is down I'm 
either not working or working on the network problem anyway, but I 
digress..). Switched this to local copies. Now some things are working 
better.

> Do
> your cron jobs above (i.e.,
>
> 19 17 * * * ls >> /tmp/debug.log 2>&1
> 20 17 * * * ls -l /tmp/myscript >> /tmp/debug.log 2>&1
>
> ) still work correctly after changing "ls" to "/bin/ls"? Does 
> changing  "/tmp/myscript" to "sh -c '/tmp/myscript'" help any?

With local /etc/passwd and /etc/group I'm able to execute /tmp/myscript. 
However I wish to execute ~/bin/<somescript>. I can't seem to get to $HOME!

Now 'round here they map the P drive to the home share via 
//<server>/<username>$ <- yeah that dollar sign thingy in Windows.

I had done a mount -bsf //<server>/$USERNAME\$ /home a long time ago. 
However trying to ls /home/bin doesn't work in cron. Neither does ls P: 
nor even ls //<server>/$USERNAME\$!

This can be seen by the following output:

Executing myscript
TPAD3741
\\rtnlprod02\viewstore\webtest\CM_DOCS\Web on /wwwtest type system (binmode)
\\rtnlprod02\viewstore\webview\CM_DOCS\Web on /www type system (binmode)
\\rtnlprod02\viewstore\PMO\CM_TOOLS on /pmo type system (binmode)
\\isdata01\TPAD3741$ on /home2 type system (binmode)
C:\Program Files on /apps type system (binmode)
C:\Cygwin\bin on /usr/bin type system (binmode)
C:\Cygwin\lib on /usr/lib type system (binmode)
C:\Cygwin on / type system (binmode)
M: on /view type system (binmode)
P: on /home type system (binmode)
b: on /dev/b type system (binmode,noumount)
c: on /dev/c type system (binmode,noumount)
New connections will be remembered.^M


Status       Local     Remote                    Network^M

-------------------------------------------------------------------------------
             M:        \\view                    ClearCase Dynamic Views
                       \\view\defaria            ClearCase Dynamic Views
The command completed successfully.^M

ls: p:: No such file or directory
ls: //isdata01/TPAD3741$: No such file or directory
End of myscript

For some reason the P drive is not available to cron at all (Note at a 
previous company I was able to get to my home share merely by using the 
mount -bsf //<server>/<share> to /home and refering to /home/$USERNAME 
for the $HOME variable. Here they do not export a <share> under which 
all users reside, rather they map, probably from ntlogin.bat, the 
specific, hidden $USERNAME share directly to the P drive.

So is P or /home off limits when it comes to cron? Why did this work at 
my  last company? I think it's probably due to the "public" share point 
versus "non-public" share point (which I never totally understood 
before) and I'm fearing that I will not be able to convince the powers 
that be to change it! :-(
-- 
C program run. C program crash. C programmer quit.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040819/12d90a93/attachment.ksh>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list