From owner-freebsd-questions Sat Feb 15 11:16:01 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id LAA09509 for questions-outgoing; Sat, 15 Feb 1997 11:16:01 -0800 (PST) Received: from base486.synet.net (imdave@DIAL44.SYNET.NET [168.113.1.48]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id LAA09484 for ; Sat, 15 Feb 1997 11:15:45 -0800 (PST) Received: (from imdave@localhost) by base486.synet.net (8.8.5/8.8.5) id NAA22396; Sat, 15 Feb 1997 13:15:35 -0600 (CST) Date: Sat, 15 Feb 1997 13:15:35 -0600 (CST) From: Dave Bodenstab Message-Id: <199702151915.NAA22396@base486.synet.net> To: freebsd-questions@freebsd.com, thompson@tgsoft.com Subject: Re: at Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > From: mark thompson > > I sometimes like to write at scripts that resubmit themselves, perhaps > one day later (sometimes this is cooler than using cron). > > This doesn't work on FreeBSD 2.1.6 (at least on my system) because the > resubmitted script starts out with: > [deleted] A similar problem occurs if you ``su'' and then attempt to use at/batch. I solved the problem for me with the following patch. Did I break something? Don't know, don't care, since it works for me. Dave Bodenstab imdave@synet.net *** at.c 1995/08/20 18:26:26 2.0 --- at.c 1995/08/20 18:27:19 2.0.1.1 *************** *** 271,290 **** if((fp = fdopen(fdes, "w")) == NULL) panic("Cannot reopen atjob file"); ! /* Get the userid to mail to, first by trying getlogin(), which reads ! * /etc/utmp, then from LOGNAME, finally from getpwuid(). */ ! mailname = getlogin(); ! if (mailname == NULL) ! mailname = getenv("LOGNAME"); ! ! if ((mailname == NULL) || (mailname[0] == '\0') ! || (strlen(mailname) > 8) || (getpwnam(mailname)==NULL)) ! { ! pass_entry = getpwuid(getuid()); ! if (pass_entry != NULL) ! mailname = pass_entry->pw_name; ! } if (atinput != (char *) NULL) { --- 271,283 ---- if((fp = fdopen(fdes, "w")) == NULL) panic("Cannot reopen atjob file"); ! /* Get the userid to mail to from getpwuid(geteuid()). */ ! pass_entry = getpwuid(geteuid()); ! if (pass_entry != NULL) ! mailname = pass_entry->pw_name; ! else ! mailname = "root"; if (atinput != (char *) NULL) {