cron in cygwin

Bill C. Riemers docbill@freeshell.org
Wed May 7 15:00:00 GMT 2003


I'd love to hear the "correct" answer for this.  This is the solution I've
come up with, and but it is way too complicated...

1. Install the SYSV init package.
2. Configure the "init" package:
    /usr/bin/init-config
3. Replace the /etc/inittab with the one I've attached.
4. Save the attached init.sh script as /usr/sbin/init.sh .
5. Create the directory /var/lock/subsys:
      mkdir -p /var/lock/subsys
5. Uninstall the init service:
      cygrunsrv -R init
6. Install the init.sh script as the init service:
      cygrunsrv -I init -p /usr/sbin/init.sh  -d "CYGWIN init" -s INT -o
7. Stop the new service:
      cygrunsrv --stop init
8. Clean the /var/log directory:
      rm /var/log/*
    (Some daemons refuse to start otherwise.)
9. Save the attached cron script as /etc/rc.d/init.d/cron
10. Create the following symbolic links:
      ln -s /etc/rc.d/init.d/cron /etc/rc.d/rc0.d/K25cron
      ln -s /etc/rc.d/init.d/cron /etc/rc.d/rc1.d/K25cron
      ln -s /etc/rc.d/init.d/cron /etc/rc.d/rc2.d/S25cron
      ln -s /etc/rc.d/init.d/cron /etc/rc.d/rc3.d/S25cron
      ln -s /etc/rc.d/init.d/cron /etc/rc.d/rc4.d/S25cron
      ln -s /etc/rc.d/init.d/cron /etc/rc.d/rc4.d/S25cron
      ln -s /etc/rc.d/init.d/cron /etc/rc.d/rc6.d/S25cron
11. Restart the init service:
      cygrunsrv --start init

NOTE 1:

If you have problems, try removing files that are automatically created, and
start the daemon again.  Something that took me a long time to realize is
"chown" does not work correctly under CYGWIN
on  Windows XP.  It will change the "owner" that cygwin shows the file as
owned by.  However,
it doesn't actually effect permissions.  i.e.
      echo "hi" > foo.txt
      chmod 600 foo.txt
      chown SYSTEM foo.txt
will create a file that appears to be owned by SYSTEM and only accessible by
"SYSTEM".  However, the "SYSTEM" user will get an EPERM error when trying to
read or write the file...
So even if a file appears to have the correct ownership under "ls" and
"getfacl", it might not...
I have not figured out a way to determine the "real" owner of a file.

NOTE 2:

My init.sh script steps back and forth through the run levels.  This is
mainly to simulate the behavior I'm used to.  If everything is configured
correctly, it should be sufficient just to switch to runlevel 6 when
shutting down and to your default run level when starting up.

                                                   Bill

----
To: cygwin@cygwin.com
From: "Sanjay Goel" <sanjaygoel@hotpop.com>
Subject: cron in cygwin
Date: Wed, 7 May 2003 13:13:37 +0530
Message-ID: <b9ad70$hkh$1@main.gmane.org>

I want to run updatedb every week ... I wrote the following in my crontab

0 22 * * 2 updatedb --localpaths="/ /c /d /e"

but it never works.

Can somebody tell me how to set cron jobs in cygwin.

Thanks in advance

Sanjay
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inittab
Type: application/octet-stream
Size: 292 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030507/32f5f94a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: init.sh
Type: application/octet-stream
Size: 300 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030507/32f5f94a/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cron
Type: application/octet-stream
Size: 1336 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030507/32f5f94a/attachment-0002.obj>
-------------- 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