CRON problems

Andrew DeFaria Andrew@DeFaria.com
Fri May 7 06:55:00 GMT 2004


Brian Dessent wrote:

> Hank Statscewich wrote:
>
>> Great suggestion. In /var/log/cron.log there were 17 lines of:
>> /usr/sbin/cron: can't open or create /var/run/cron.pid: Permission denied
>>
>> So I just changed permission of the file to 777 and cron started up 
>> just fine.
>> I rebooted and lo and behold cron is still running. I'm changing 
>> permission
>> back to something more appropriate now. I am now a fully satisfied 
>> cygwin user.
>> Thansk for such a great port of linux onto windows, Cygwin is the 
>> best of both
>> worlds (at least for now :)
>
>
> Hmm, seems to me like checking ownership and permissions of cron.pid 
> would be something the cron_diagnose.sh should do. What happened was 
> that you ran it initially as your normal user account, and the pid 
> file was created. Then when you tried to start it as a service, it was 
> running as the SYSTEM account which didn't have permissions to 
> overwrite the file. The solution would be to either just remove it and 
> let cron recreate it, or "chown SYSTEM:SYSTEM /var/run/cron.pid". Then 
> you could give it more restrictive permissions than 777, perhaps 640 
> or 600.

You should also check the ownership/permissions of /var/cron* and 
/var/log/cron.log. When I setup cron I normally do:

# Make sure that certain directories and files do not exist! This is to let
# cron create them, which appears to be the only way to get these created
# correctly!
if [ ! -d /var/cron ]; then
  rm -rf /var/cron
  rm -rf /var/run/cron.pid
  rm -rf /var/log/cron.log

  # Install cron service:
  cygrunsrv -I cron -p /usr/sbin/cron -a -D -d "Cygwin cron" -e 
"MAILTO=$USER@Salira.com" -e "CYGWIN=ntsec"
fi

# Start cron service
cygrunsrv -S cron

-- 
3 kinds of people: those who can count & those who can't.


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