Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Feb 1997 13:15:35 -0600 (CST)
From:      Dave Bodenstab <imdave@synet.net>
To:        freebsd-questions@freebsd.com, thompson@tgsoft.com
Subject:   Re: at
Message-ID:  <199702151915.NAA22396@base486.synet.net>

next in thread | raw e-mail | index | archive | help

> From: mark thompson <thompson@tgsoft.com>
>
> 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)
      {





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702151915.NAA22396>