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]

FYI: one step by step method to setup cron for cygwin 1.3.10


This worked for me today, thought I would share the
method.  I tested this a couple of times (installing/uninstalling).

Pls let me know if anything is incorrect; cron appears to be
running fine.  Not sure why I had to create dir /etc/cron.d (it is still
empty - I did so because the application event log had a warning or
error when I didn't).

uname -a says:
  CYGWIN_NT-4.0 ARGON 1.3.10(0.51/3/2) 2002-02-25 11:14 i686 unknown
on my system.

regards,
Tom Rodman

--v-v------------------C-U-T---H-E-R-E-------------------------v-v--
cygwin cron setup steps {

# ====================================================================
# (optional) uninstall cron
# ====================================================================
  cygrunsrv -E cron #stop cron
  ps -e|grep cron
  kill -TERM {cron pids} # if needed
  cygrunsrv -R cron # remove service

  # save old crontab files if needed
  bu=/tmp/cronsave
  mkdir $bu
  cp /var/cron/tabs/* $bu ; ls $bu
  ls -l $bu/$(id -un)

  # delete dirs needed by cron (up to you to backup if needed)
  find /var/cron|xargs chown $(id -un)
  rm -rf /var/cron # let first cron process create /var/cron /var/cron/tabs
    # if stubborn try: "tlist bash|egrep -8 'CWD.*/cron'

  rm -rf /var/run /etc/cron.d

# ====================================================================
# install cron
# ====================================================================
echo $CYGWIN # should be "binmode tty ntsec"
groups # you should be in administrators or "domain administrators"? group

restore_old_umask=$(umask -p) ; umask -S
umask 0003; umask -S

# prepare example crontab
bu=/tmp/cronsave; mkdir -p $bu
echo '* * * * * id >>   /tmp/crontest.out'  >$bu/crontab_example
echo '* * * * * date >> /tmp/crontest.out' >>$bu/crontab_example

xx="/var/run /etc/cron.d"  # dirs needed by cron; neither pre-exist or 
                           # are created automatically by cron
mkdir -p $xx
chgrp system $xx;  ls -ld $xx

cygrunsrv -I cron -p /usr/sbin/cron -a -D -e "CYGWIN=binmode tty ntsec"
cygrunsrv -S cron; ps -e|grep cron
less /var/log/cron.log # /var/cron and /var/cron/tabs get created
ls -ld /var/cron /var/cron/tabs
ls -l /var/run/cron.pid
# check NT application event log also

# ====================================================================
# set up crontab
# ====================================================================
crontab -e # :r /tmp/cronsave/$(id -un) # restore from backup
           # or ":r/tmp/cronsave/crontab_example"  # just use example
           # edit as appropriate

stty sane # blind typing/no echo, bug in "crontab -e" ?!
ls -lrt /var/cron/tabs

sleep 60 ;cat /tmp/crontest.out

# ====================================================================
$restore_old_umask ; umask -S

}

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