Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: otaku.freeshell.org: docbill owned process doing -bs Message-ID: <00cb01c314a9$69c25d80$6400a8c0@FoxtrotTech0001> From: "Bill C. Riemers" To: References: <1052316960 DOT 27759 DOT ezmlm AT cygwin DOT com> Subject: cron in cygwin Date: Wed, 7 May 2003 10:59:16 -0400 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_00BE_01C31487.B39FCA40" X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 ------=_NextPart_000_00BE_01C31487.B39FCA40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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 AT cygwin DOT com From: "Sanjay Goel" Subject: cron in cygwin Date: Wed, 7 May 2003 13:13:37 +0530 Message-ID: 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 ------=_NextPart_000_00BE_01C31487.B39FCA40 Content-Type: application/octet-stream; name="inittab" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="inittab" # id:runlevels:action:process=0A= id:3:initdefault:=0A= rc::bootwait:/etc/rc=0A= #S0:2345:respawn:/sbin/agetty -L -T vt100 -n ttyS0 9600 ttyS0=0A= I0:0:wait:/etc/rc.d/rc=0A= I1:1:wait:/etc/rc.d/rc=0A= I2:2:wait:/etc/rc.d/rc=0A= I3:3:wait:/etc/rc.d/rc=0A= I4:4:wait:/etc/rc.d/rc=0A= I5:5:wait:/etc/rc.d/rc=0A= I6:6:wait:/etc/rc.d/rc=0A= ------=_NextPart_000_00BE_01C31487.B39FCA40 Content-Type: application/octet-stream; name="init.sh" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="init.sh" #!/usr/bin/bash=0A= rm -f /var/lock/subsys/*=0A= /sbin/init.exe -i 0 & p=3D$!=0A= trap "/sbin/telinit 6;sleep 5;kill -INT $p;exit" SIGINT=0A= sleep 5=0A= /sbin/telinit 1=0A= sleep 5=0A= /sbin/telinit 2=0A= sleep 5=0A= /sbin/telinit 3=0A= sleep 5=0A= trap '/sbin/init -i 6 & p=3D$!;sleep 5;kill -INT $p;exit' SIGINT=0A= while [ 1 ] ; do=0A= sleep 30=0A= done=0A= ------=_NextPart_000_00BE_01C31487.B39FCA40 Content-Type: application/octet-stream; name="cron" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cron" #!/bin/bash=0A= #=0A= # Init file for CRON daemon=0A= #=0A= # chkconfig: 2345 55 25=0A= # description: CRON daemon=0A= #=0A= # processname: cron=0A= # pidfile: /var/run/cron.pid=0A= =0A= # source function library=0A= . /etc/rc.d/init.d/functions=0A= =0A= # pull in sysconfig settings=0A= [ -f /etc/sysconfig/cron ] && . /etc/sysconfig/sshd=0A= =0A= RETVAL=3D0=0A= prog=3D"cron"=0A= =0A= # Some functions to make the below more readable=0A= CRON=3D/usr/sbin/cron=0A= =0A= do_restart_sanity_check()=0A= {=0A= $CRON =0A= RETVAL=3D$?=0A= if [ ! "$RETVAL" =3D 0 ]; then=0A= failure $"Configuration file or keys are invalid"=0A= echo=0A= fi=0A= }=0A= =0A= start()=0A= {=0A= # Create keys if necessary=0A= echo -n $"Starting $prog:"=0A= daemon $CRON $OPTIONS && success || failure=0A= RETVAL=3D$?=0A= [ "$RETVAL" =3D 0 ] && touch /var/lock/subsys/cron=0A= echo=0A= }=0A= =0A= stop()=0A= {=0A= echo -n $"Stopping $prog:"=0A= killproc $CRON -TERM=0A= RETVAL=3D$?=0A= [ "$RETVAL" =3D 0 ] && rm -f /var/lock/subsys/cron=0A= echo=0A= }=0A= =0A= reload()=0A= {=0A= echo -n $"Reloading $prog:"=0A= killproc $CRON -HUP=0A= RETVAL=3D$?=0A= echo=0A= }=0A= =0A= case "$1" in=0A= start)=0A= start=0A= ;;=0A= stop)=0A= stop=0A= ;;=0A= restart)=0A= stop=0A= start=0A= ;;=0A= reload)=0A= reload=0A= ;;=0A= condrestart)=0A= if [ -f /var/lock/subsys/cron ] ; then=0A= do_restart_sanity_check=0A= if [ "$RETVAL" =3D 0 ] ; then=0A= stop=0A= # avoid race=0A= sleep 3=0A= start=0A= fi=0A= fi=0A= ;;=0A= status)=0A= status $CRON=0A= RETVAL=3D$?=0A= ;;=0A= *)=0A= echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"=0A= RETVAL=3D1=0A= esac=0A= exit $RETVAL=0A= ------=_NextPart_000_00BE_01C31487.B39FCA40 Content-Type: text/plain; charset=us-ascii -- 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/ ------=_NextPart_000_00BE_01C31487.B39FCA40--