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 Message-Id: <3.0.5.32.20030414224423.007f8c50@mail.attbi.com> X-Sender: phumblet AT mail DOT attbi DOT com (Unverified) Date: Mon, 14 Apr 2003 22:44:23 -0400 To: cygwin AT cygwin DOT com From: "Pierre A. Humblet" Subject: Crontab on Win9X works Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_1050389063==_" --=====================_1050389063==_ Content-Type: text/plain; charset="us-ascii" Corinna, The attached patch modifies crontab.c to let cron run as it should on Win9x. The change in env.c reverts to ignoring the daemon environment, on Win9x only. USE_SIGCHLD is now left undefined in compat.h to get rid of a syslog message about the mail command failing. In addition I would like to allow the use of mailers other than ssmtp while preserving current installations. This is done by patching compat.h to remove #define _PATH_SENDMAIL "/usr/sbin/ssmtp" and patching /etc/postinstall/cron.sh to ln -s /usr/sbin/ssmtp.exe /usr/sbin/sendmail Users are free to point /usr/sbin/sendmail as they wish. Pierre --=====================_1050389063==_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cron.diff" --- crontab.c.orig 2001-09-19 13:09:56.000000000 -0400 +++ crontab.c 2003-04-14 20:19:50.000000000 -0400 @@ -694,6 +694,17 @@ poke_daemon() { return; } #else +#ifdef __CYGWIN__ + if (GetVersion() & 0x80000000) { + if (utime(SYSCRONTAB, NULL) < OK && + (errno !=3D ENOENT || + open(SYSCRONTAB, O_RDONLY | O_CREAT, 0644) < 0))= { + fprintf(stderr, "crontab: can't update mtime on= crontab\n"); + perror(SYSCRONTAB); + } + return; + } +#endif if (utime(SPOOL_DIR, NULL) < OK) { fprintf(stderr, "crontab: can't update mtime on spooldir\n"); perror(SPOOL_DIR); --- env.c.orig 2002-07-05 05:56:22.000000000 -0400 +++ env.c 2003-04-14 19:50:16.000000000 -0400 @@ -59,14 +59,14 @@ env_init() { #ifdef __CYGWIN__ static char **int_env_copy(); - return int_env_copy(environ, cyg_exclude); -#else + if ((GetVersion() & 0x80000000) =3D=3D 0) + return int_env_copy(environ, cyg_exclude); +#endif register char **p =3D (char **) malloc(sizeof(char **)); if (p) p[0] =3D NULL; return (p); -#endif } --- compat.h.orig 2001-06-07 12:11:28.000000000 -0400 +++ compat.h 2003-04-14 22:00:24.000000000 -0400 @@ -113,7 +113,8 @@ # define HAVE_SAVED_UIDS #endif -#if !defined(ATT) && !defined(__linux) && !defined(IRIX) &&= !defined(UNICOS) +#if !defined(ATT) && !defined(__linux) && !defined(IRIX) && \ + !defined(UNICOS) && !defined(__CYGWIN__) # define USE_SIGCHLD #endif @@ -148,7 +149,7 @@ #endif #if defined(__CYGWIN__) -#define _PATH_SENDMAIL "/usr/sbin/ssmtp" +#include #define CRONDIR "/var/cron" #define _PATH_VARRUN "/var/run/" #endif --- cron.sh.done 2003-04-11 15:43:12.000000000 -0400 +++ cron.sh 2003-04-14 20:32:04.000000000 -0400 @@ -13,3 +13,12 @@ then mkdir /var/cron/tabs fi chmod 1777 /var/cron/tabs + +if [ ! -d /usr/sbin ] +then + mkdir -p /usr/sbin +fi +if [ ! -e /usr/sbin/sendmail -a ! -L /usr/sbin/sendmail ] +then + ln -s /usr/sbin/ssmtp.exe /usr/sbin/sendmail +fi --=====================_1050389063==_ Content-Type: text/plain; charset=us-ascii -- 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/ --=====================_1050389063==_--