This is the mail archive of the cygwin@cygwin.com 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]

Re: Setting up user mode cron


  Larry Hall (RFK Partners, Inc) wrote:

>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?
>
OK let's scale back a little bit. The situation is that I would like to 
run cron on my desktop and by extension allow my users to run their own 
crons on their desktop. We're in a domain and as such we have set it up 
such that people's home directories are mounted on /home from the 
Windows server that houses the home directories. Therefore we have the 
following mount:

\\sonscentral\users on /home type system (textmode).

Given my username, adefaria, therefore ls /home/adefaria (or ls ~) will 
list the contents of \\sonscentral\users\adefaria. Note there are no 
mapped drives here, just UNC names.

So when I set up cron I expect that when a cronjob is running for me 
(adefaria) that I am in /home/adefaria (effectively on 
\\sonscentral\users\adefarai) and I'm running as the user adefaria. And 
I am. As my cronjobs told me I am adefaria and my CWD is /home/adefaria. 
Problem is that if I do an ls (outputting to /tmp/cron.log) I see 
nothing. Further more if I execute foo where foo is /home/adefaria/foo 
and let's say foo does merely an

echo "Foo executed on $(date)" >> /tmp/cron.log

I do not see /tmp/cron.log updated with that echo. Instead I get email 
saying "foo: not found". I also tried /home/adefaria/foo as well as 
//sonscentral/users/adefaria/foo (got email saying /home/adefaria/foo 
not found, etc).

Moving foo to /tmp/foo works however changing the echo to attempt to 
write ~/cron.log reveals permission denied when trying to write to that 
file. Ah ha! Getting somewhere. Apparently cron cannot deal with a 
network place be it a mapped drive of a Cygwin mounted UNC path.

>>>>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.
>
Well that would be the parameter for the script update_view. IOW is 
should read something like

$ /tmp/update_view //sons-clearcase/Views/defaria

Otherwise the script will just echo out the error message you see.

Found out that my /tmp/update_view lacked execute bits and that was why 
cron couldn't "find" it. Turning on the execute bits makes it run 
however, like we've seen here, any references to network areas causes 
problems. Anybody know why cron can't deal with network locations?

>> 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.
>
Yes, apparently cron is running the job as me but this "me" doesn't have 
permissions to access network stuff.

>> "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.
>
Sorry, I didn't equate a, say Z Drive accessed through /cygdrive/z as 
the same thing as a mount /mnt/sharedscripts //<server>/<script dir>.

>> 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.
>
Damn! I wish I could figure this out. Perhaps somebody else will chime in...





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


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