Subject: Re: Setting up user mode cron
From: "Larry Hall (RFK Partners, Inc)" <[email-masked]>
To: Andrew DeFaria <[email-masked]>
Cc: [email-masked]
Date: Wed, 09 Jan 2002 19:53:16 -0500

At 06:25 PM 1/9/2002, Andrew DeFaria wrote:
>Larry Hall (RFK Partners, Inc) wrote:
>
>>At 05:06 PM 1/9/2002, Andrew DeFaria wrote:
>>
>>>I've set up cron on my desktop according to /usr/doc/Cygwin/cron.README which states I should:
>>>
>>>$ cygrunsrv -I cron -p /usr/sbin/cron -a D -e "CYGWIN=ntsec"
>>>$ cygrunsrv -S cron
>>>
>>>And I have the following crontab installed:
>>>
>>>15 * * * * echo -e "Debugging cron $(date)\n"                >  
>>>/tmp/cron.log
>>>16 * * * * echo -e "Working directory:\n\n$(pwd)\n"          >> /tmp/cron.log
>>>17 * * * * echo -e "ID info:\n\n$(id)\n"                     >> /tmp/cron.log
>>>18 * * * * echo -e "Directory listing:\n\n$(ls)\n"           >> /tmp/cron.log
>>>19 * * * * echo -e "Script file:\n\n$(ls /tmp/update_view)\n" >> /tmp/cron.log
>>>20 * * * * echo -e "Executing: /tmp/update_view defaria"     >> /tmp/cron.log
>>>21 * * * * /tmp/update_view defaria                          >> /tmp/cron.log
>>>
>>>The resulting output is:
>>>
>>>Debugging cron Wed Jan  9 13:15:01  2002
>>>
>>>Working directory:
>>>
>>>/home/adefaria
>>>
>>>ID info:
>>>
>>>uid=1370(adefaria) gid=513(Domain Users) groups=0(Everyone),512(Domain Admins),513(Domain Users),1170(Everybody),1382(ITSupport)
>>>
>>>Directory listing:
>>>
>>>
>>>
>>>Script file:
>>>
>>>/tmp/update_view
>>>
>>>Executing: /tmp/update_view defaria
>>>
>>>It seems like cron works OK and runs as me in my home directory but I cannot access nor run any scripts! Not even in /tmp! Why?
>>
>>
>>Did you choose to mount '/' as 'user' rather than 'system' during the install?  Check the output of 'mount' to find out.
>No I didn't do any mounting of '/' as 'user" that I can see:
>
>$ mount
>\\sons-mrp\LJ45500-Color on /dev/LJ45500-Color type system (binmode)
>\\sons-clearcase\views on /view type system (textmode)
>\\sons-mrp\LJ4050PCL6 on /dev/LJ4050PCL6 type system (binmode)
>\\sonscentral\users on /home type system (textmode)
>\\sons-mrp\LJ8150 on /dev/LJ8150 type system (binmode)
>\\sons-mrp\LJ8150 on /dev/lp 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)
>c: on /dev/c type system (textmode,noumount)
>g: on /dev/g type system (textmode,noumount)
>h: on /dev/h type system (textmode,noumount)
>q: on /dev/q type system (textmode,noumount)
>t: on /dev/t type system (textmode,noumount)

OK, yes all your mounts are system.  Looking back over your original 
comments, what doesn't work again?  You seem to indicate that cron is 
running.  The output you show indicates it did run.  But you claim it
didn't run a script.  How did you determine that?  Perhaps you're 
interpreting the fact that you're having problems accessing the network
share as a cron script execution problem?

>>>Executing this script from the command line yeilds:
>>>
>>>$ /tmp/update_view defaria
>>>update_view: Warning: View pname does not exist: defaria
>>>
>>>View pnames should be UNC names that lead to the top of the view
>>>For example: //sons-clearcase/Views/<viewname>
>>
>>I believe you need to alter the permissions of the 'SYSTEM' account so that it can access the network.  
>What "network" am I accessing when I try to run /tmp/update_view? It's my

Good question.  Using your example above, 
//sons-clearcase/Views/<viewname>.  That's what I'm assuming lacking any
other information from you.

>  understanding that /tmp is local. Of course my home directory is on the network. Is that what you mean? Anyhow, how do I alter the permissions of

Assuming you're trying to access your home directory in your script, yes.

>  "SYSTEM" account so that it can access the network. What I have in my /etc/passwd is:
>
>$ grep -i system /etc/passwd
>SYSTEM:*:18:18:,S-1-5-18::
>
>>I might be wrong on this.  Check the email archives for similar discussions on cron.  This *has* come up before.
>I had checked and read a lot about cron in the archives before this. I didn't see anything that explained it. I saw stuff saying that cron cannot access network drives. Does this also mean that cron cannot access network mount points say like when you mount /mnt/share //<server>/<share>? Does it main you cannot then run /mnt/share/myscript?

Yep, network drives are a no-no.  If this is how you're trying to access
the network, then that's your problem.  Try using the UNC paths directly.
If that doesn't work, I can only point you to the mail archives.  I 
remember this being discussed and my recollection is the solution was 
'use UNC paths'.  But my memory could be wrong.  Perhaps someone else's
memory is clearer on this subject.

>  Or does it mean if your home directory happens to be /mnt/share/home/<me> then I can't run anything including /tmp/myscript?!?
>
>Another, cron related problem. On my Windows 2000 server I tried to set up cron:
>
>$ cygrunsrv -I cron -p /usr/sbin/cron -a D -e "CYGWIN=ntsec"
>$ cygrunsrv -S cron
>cygrunsrv: Error starting a service: QueryServiceStatus:  Win32 error 1062:
>The service has not been started.
>
>Any ideas?

At the moment, no.

Sorry.

Larry Hall                              [email-masked]
RFK Partners, Inc.                      http://www.rfk.com
838 Washington Street                   (508) 893-9779 - RFK Office
Holliston, MA 01746                     (508) 893-9889 - FAX

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/