Index: head/usr.bin/at/at.c =================================================================== --- head/usr.bin/at/at.c (revision 89632) +++ head/usr.bin/at/at.c (revision 89633) @@ -1,853 +1,845 @@ /* * at.c : Put file into atrun queue * Copyright (C) 1993, 1994 Thomas Koenig * * Atrun & Atq modifications * Copyright (C) 1993 David Parsons * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. The name of the author(s) may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #define _USE_BSD 1 /* System Headers */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef __FreeBSD__ #include #else #include #endif #if (MAXLOGNAME-1) > UT_NAMESIZE #define LOGNAMESIZE UT_NAMESIZE #else #define LOGNAMESIZE (MAXLOGNAME-1) #endif /* Local headers */ #include "at.h" #include "panic.h" #include "parsetime.h" #include "perm.h" #define MAIN #include "privs.h" /* Macros */ #ifndef ATJOB_DIR #define ATJOB_DIR "/usr/spool/atjobs/" #endif #ifndef LFILE #define LFILE ATJOB_DIR ".lockfile" #endif #ifndef ATJOB_MX #define ATJOB_MX 255 #endif #define ALARMC 10 /* Number of seconds to wait for timeout */ #define SIZE 255 #define TIMESIZE 50 enum { ATQ, ATRM, AT, BATCH, CAT }; /* what program we want to run */ /* File scope variables */ const char *no_export[] = { "TERM", "TERMCAP", "DISPLAY", "_" } ; static int send_mail = 0; /* External variables */ extern char **environ; int fcreated; char atfile[] = ATJOB_DIR "12345678901234"; char *atinput = (char*)0; /* where to get input from */ char atqueue = 0; /* which queue to examine for jobs (atq) */ char atverify = 0; /* verify time instead of queuing job */ char *namep; /* Function declarations */ static void sigc(int signo); static void alarmc(int signo); static char *cwdname(void); static void writefile(time_t runtimer, char queue); static void list_jobs(void); static long nextjob(void); static time_t ttime(const char *arg); /* Signal catching functions */ static void sigc(int signo __unused) { /* If the user presses ^C, remove the spool file and exit */ if (fcreated) { PRIV_START unlink(atfile); PRIV_END } _exit(EXIT_FAILURE); } static void alarmc(int signo __unused) { char buf[1024]; /* Time out after some seconds. */ strlcpy(buf, namep, sizeof(buf)); strlcat(buf, ": file locking timed out\n", sizeof(buf)); write(STDERR_FILENO, buf, strlen(buf)); sigc(0); } /* Local functions */ static char *cwdname(void) { /* Read in the current directory; the name will be overwritten on * subsequent calls. */ static char *ptr = NULL; static size_t size = SIZE; if (ptr == NULL) if ((ptr = malloc(size)) == NULL) errx(EXIT_FAILURE, "virtual memory exhausted"); while (1) { if (ptr == NULL) panic("out of memory"); if (getcwd(ptr, size-1) != NULL) return ptr; if (errno != ERANGE) perr("cannot get directory"); free (ptr); size += SIZE; if ((ptr = malloc(size)) == NULL) errx(EXIT_FAILURE, "virtual memory exhausted"); } } static long nextjob() { long jobno; FILE *fid; if ((fid = fopen(ATJOB_DIR ".SEQ", "r+")) != (FILE*)0) { if (fscanf(fid, "%5lx", &jobno) == 1) { rewind(fid); jobno = (1+jobno) % 0xfffff; /* 2^20 jobs enough? */ fprintf(fid, "%05lx\n", jobno); } else jobno = EOF; fclose(fid); return jobno; } else if ((fid = fopen(ATJOB_DIR ".SEQ", "w")) != (FILE*)0) { fprintf(fid, "%05lx\n", jobno = 1); fclose(fid); return 1; } return EOF; } static void writefile(time_t runtimer, char queue) { /* This does most of the work if at or batch are invoked for writing a job. */ long jobno; char *ap, *ppos, *mailname; struct passwd *pass_entry; struct stat statbuf; int fdes, lockdes, fd2; FILE *fp, *fpin; struct sigaction act; char **atenv; int ch; mode_t cmask; struct flock lock; #ifdef __FreeBSD__ (void) setlocale(LC_TIME, ""); #endif /* Install the signal handler for SIGINT; terminate after removing the * spool file if necessary */ act.sa_handler = sigc; sigemptyset(&(act.sa_mask)); act.sa_flags = 0; sigaction(SIGINT, &act, NULL); ppos = atfile + strlen(ATJOB_DIR); /* Loop over all possible file names for running something at this * particular time, see if a file is there; the first empty slot at any * particular time is used. Lock the file LFILE first to make sure * we're alone when doing this. */ PRIV_START if ((lockdes = open(LFILE, O_WRONLY | O_CREAT, S_IWUSR | S_IRUSR)) < 0) perr("cannot open lockfile " LFILE); lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; lock.l_len = 0; act.sa_handler = alarmc; sigemptyset(&(act.sa_mask)); act.sa_flags = 0; /* Set an alarm so a timeout occurs after ALARMC seconds, in case * something is seriously broken. */ sigaction(SIGALRM, &act, NULL); alarm(ALARMC); fcntl(lockdes, F_SETLKW, &lock); alarm(0); if ((jobno = nextjob()) == EOF) perr("cannot generate job number"); sprintf(ppos, "%c%5lx%8lx", queue, jobno, (unsigned long) (runtimer/60)); for(ap=ppos; *ap != '\0'; ap ++) if (*ap == ' ') *ap = '0'; if (stat(atfile, &statbuf) != 0) if (errno != ENOENT) perr("cannot access " ATJOB_DIR); /* Create the file. The x bit is only going to be set after it has * been completely written out, to make sure it is not executed in the * meantime. To make sure they do not get deleted, turn off their r * bit. Yes, this is a kluge. */ cmask = umask(S_IRUSR | S_IWUSR | S_IXUSR); if ((fdes = creat(atfile, O_WRONLY)) == -1) perr("cannot create atjob file"); if ((fd2 = dup(fdes)) <0) perr("error in dup() of job file"); if(fchown(fd2, real_uid, real_gid) != 0) perr("cannot give away file"); PRIV_END /* We no longer need suid root; now we just need to be able to write * to the directory, if necessary. */ REDUCE_PRIV(DAEMON_UID, DAEMON_GID) /* We've successfully created the file; let's set the flag so it * gets removed in case of an interrupt or error. */ fcreated = 1; /* Now we can release the lock, so other people can access it */ lock.l_type = F_UNLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; lock.l_len = 0; fcntl(lockdes, F_SETLKW, &lock); close(lockdes); 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) > LOGNAMESIZE) || (getpwnam(mailname)==NULL)) { pass_entry = getpwuid(real_uid); if (pass_entry != NULL) mailname = pass_entry->pw_name; } if (atinput != (char *) NULL) { fpin = freopen(atinput, "r", stdin); if (fpin == NULL) perr("cannot open input file"); } fprintf(fp, "#!/bin/sh\n# atrun uid=%ld gid=%ld\n# mail %*s %d\n", (long) real_uid, (long) real_gid, LOGNAMESIZE, mailname, send_mail); /* Write out the umask at the time of invocation */ fprintf(fp, "umask %lo\n", (unsigned long) cmask); /* Write out the environment. Anything that may look like a * special character to the shell is quoted, except for \n, which is * done with a pair of "'s. Don't export the no_export list (such * as TERM or DISPLAY) because we don't want these. */ for (atenv= environ; *atenv != NULL; atenv++) { int export = 1; char *eqp; eqp = strchr(*atenv, '='); if (ap == NULL) eqp = *atenv; else { size_t i; for (i=0; i&2\n\t exit 1\n}\n"); while((ch = getchar()) != EOF) fputc(ch, fp); fprintf(fp, "\n"); if (ferror(fp)) panic("output error"); if (ferror(stdin)) panic("input error"); fclose(fp); /* Set the x bit so that we're ready to start executing */ if (fchmod(fd2, S_IRUSR | S_IWUSR | S_IXUSR) < 0) perr("cannot give away file"); close(fd2); fprintf(stderr, "Job %ld will be executed using /bin/sh\n", jobno); } static void list_jobs() { /* List all a user's jobs in the queue, by looping through ATJOB_DIR, * or everybody's if we are root */ struct passwd *pw; DIR *spool; struct dirent *dirent; struct stat buf; struct tm runtime; unsigned long ctm; char queue; long jobno; time_t runtimer; char timestr[TIMESIZE]; int first=1; #ifdef __FreeBSD__ (void) setlocale(LC_TIME, ""); #endif PRIV_START if (chdir(ATJOB_DIR) != 0) perr("cannot change to " ATJOB_DIR); if ((spool = opendir(".")) == NULL) perr("cannot open " ATJOB_DIR); /* Loop over every file in the directory */ while((dirent = readdir(spool)) != NULL) { if (stat(dirent->d_name, &buf) != 0) perr("cannot stat in " ATJOB_DIR); /* See it's a regular file and has its x bit turned on and * is the user's */ if (!S_ISREG(buf.st_mode) || ((buf.st_uid != real_uid) && ! (real_uid == 0)) || !(S_IXUSR & buf.st_mode || atverify)) continue; if(sscanf(dirent->d_name, "%c%5lx%8lx", &queue, &jobno, &ctm)!=3) continue; if (atqueue && (queue != atqueue)) continue; runtimer = 60*(time_t) ctm; runtime = *localtime(&runtimer); strftime(timestr, TIMESIZE, "%+", &runtime); if (first) { printf("Date\t\t\tOwner\tQueue\tJob#\n"); first=0; } pw = getpwuid(buf.st_uid); printf("%s\t%s\t%c%s\t%ld\n", timestr, pw ? pw->pw_name : "???", queue, (S_IXUSR & buf.st_mode) ? "":"(done)", jobno); } PRIV_END } static void process_jobs(int argc, char **argv, int what) { /* Delete every argument (job - ID) given */ int i; struct stat buf; DIR *spool; struct dirent *dirent; unsigned long ctm; char queue; long jobno; PRIV_START if (chdir(ATJOB_DIR) != 0) perr("cannot change to " ATJOB_DIR); if ((spool = opendir(".")) == NULL) perr("cannot open " ATJOB_DIR); PRIV_END /* Loop over every file in the directory */ while((dirent = readdir(spool)) != NULL) { PRIV_START if (stat(dirent->d_name, &buf) != 0) perr("cannot stat in " ATJOB_DIR); PRIV_END if(sscanf(dirent->d_name, "%c%5lx%8lx", &queue, &jobno, &ctm)!=3) continue; for (i=optind; i < argc; i++) { if (atoi(argv[i]) == jobno) { if ((buf.st_uid != real_uid) && !(real_uid == 0)) errx(EXIT_FAILURE, "%s: not owner", argv[i]); switch (what) { case ATRM: PRIV_START if (unlink(dirent->d_name) != 0) perr(dirent->d_name); PRIV_END break; case CAT: { FILE *fp; int ch; PRIV_START fp = fopen(dirent->d_name,"r"); PRIV_END if (!fp) { perr("cannot open file"); } while((ch = getc(fp)) != EOF) { putchar(ch); } } break; default: errx(EXIT_FAILURE, "internal error, process_jobs = %d", what); } } } } } /* delete_jobs */ #define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2; static time_t ttime(const char *arg) { /* * This is pretty much a copy of stime_arg1() from touch.c. I changed * the return value and the argument list because it's more convenient * (IMO) to do everything in one place. - Joe Halpin */ struct timeval tv[2]; time_t now; struct tm *t; int yearset; char *p; if (gettimeofday(&tv[0], NULL)) panic("Cannot get current time"); /* Start with the current time. */ now = tv[0].tv_sec; if ((t = localtime(&now)) == NULL) panic("localtime"); /* [[CC]YY]MMDDhhmm[.SS] */ if ((p = strchr(arg, '.')) == NULL) t->tm_sec = 0; /* Seconds defaults to 0. */ else { if (strlen(p + 1) != 2) goto terr; *p++ = '\0'; t->tm_sec = ATOI2(p); } yearset = 0; switch(strlen(arg)) { case 12: /* CCYYMMDDhhmm */ t->tm_year = ATOI2(arg); t->tm_year *= 100; yearset = 1; /* FALLTHROUGH */ case 10: /* YYMMDDhhmm */ if (yearset) { yearset = ATOI2(arg); t->tm_year += yearset; } else { yearset = ATOI2(arg); t->tm_year = yearset + 2000; } t->tm_year -= 1900; /* Convert to UNIX time. */ /* FALLTHROUGH */ case 8: /* MMDDhhmm */ t->tm_mon = ATOI2(arg); --t->tm_mon; /* Convert from 01-12 to 00-11 */ t->tm_mday = ATOI2(arg); t->tm_hour = ATOI2(arg); t->tm_min = ATOI2(arg); break; default: goto terr; } t->tm_isdst = -1; /* Figure out DST. */ tv[0].tv_sec = tv[1].tv_sec = mktime(t); if (tv[0].tv_sec != -1) return tv[0].tv_sec; else terr: panic( "out of range or illegal time specification: [[CC]YY]MMDDhhmm[.SS]"); } int main(int argc, char **argv) { int c; char queue = DEFAULT_AT_QUEUE; char queue_set = 0; char *pgm; int program = AT; /* our default program */ - const char *options = "q:f:t:rmvldbVc"; /* default options for at */ - int disp_version = 0; + const char *options = "q:f:t:rmvldbc"; /* default options for at */ time_t timer; timer = -1; RELINQUISH_PRIVS /* Eat any leading paths */ if ((pgm = strrchr(argv[0], '/')) == NULL) pgm = argv[0]; else pgm++; namep = pgm; /* find out what this program is supposed to do */ if (strcmp(pgm, "atq") == 0) { program = ATQ; - options = "q:vV"; + options = "q:v"; } else if (strcmp(pgm, "atrm") == 0) { program = ATRM; - options = "V"; + options = ""; } else if (strcmp(pgm, "batch") == 0) { program = BATCH; - options = "f:q:mvV"; + options = "f:q:mv"; } /* process whatever options we can process */ opterr=1; while ((c=getopt(argc, argv, options)) != -1) switch (c) { case 'v': /* verify time settings */ atverify = 1; break; case 'm': /* send mail when job is complete */ send_mail = 1; break; case 'f': atinput = optarg; break; case 'q': /* specify queue */ if (strlen(optarg) > 1) usage(); atqueue = queue = *optarg; if (!(islower(queue)||isupper(queue))) usage(); queue_set = 1; break; case 'd': warnx("-d is deprecated; use -r instead"); /* fall through to 'r' */ case 'r': if (program != AT) usage(); program = ATRM; - options = "V"; + options = ""; break; case 't': if (program != AT) usage(); timer = ttime(optarg); break; case 'l': if (program != AT) usage(); program = ATQ; - options = "q:vV"; + options = "q:v"; break; case 'b': if (program != AT) usage(); program = BATCH; - options = "f:q:mvV"; + options = "f:q:mv"; break; - case 'V': - disp_version = 1; - break; - case 'c': program = CAT; options = ""; break; default: usage(); break; } /* end of options eating */ - - if (disp_version) - fprintf(stderr, "%s version " VERSION "\n", namep); /* select our program */ if(!check_permission()) errx(EXIT_FAILURE, "you do not have permission to use this program"); switch (program) { case ATQ: REDUCE_PRIV(DAEMON_UID, DAEMON_GID) list_jobs(); break; case ATRM: REDUCE_PRIV(DAEMON_UID, DAEMON_GID) process_jobs(argc, argv, ATRM); break; case CAT: process_jobs(argc, argv, CAT); break; case AT: /* * If timer is > -1, then the user gave the time with -t. In that * case, it's already been set. If not, set it now. */ if (timer == -1) timer = parsetime(argc, argv); if (atverify) { struct tm *tm = localtime(&timer); fprintf(stderr, "%s\n", asctime(tm)); } writefile(timer, queue); break; case BATCH: if (queue_set) queue = toupper(queue); else queue = DEFAULT_BATCH_QUEUE; if (argc > optind) timer = parsetime(argc, argv); else timer = time(NULL); if (atverify) { struct tm *tm = localtime(&timer); fprintf(stderr, "%s\n", asctime(tm)); } writefile(timer, queue); break; default: panic("internal error"); break; } exit(EXIT_SUCCESS); } Index: head/usr.bin/at/at.man =================================================================== --- head/usr.bin/at/at.man (revision 89632) +++ head/usr.bin/at/at.man (revision 89633) @@ -1,331 +1,322 @@ .\" $FreeBSD$ .Dd January 13, 2002 .Dt "AT" 1 .Os .Sh NAME .Nm at , .Nm batch , .Nm atq , .Nm atrm .Nd queue, examine or delete jobs for later execution .Sh SYNOPSIS .Nm at -.Op Fl V .Op Fl q Ar queue .Op Fl f Ar file .Op Fl mldbv .Ar time .Nm at -.Op Fl V .Op Fl q Ar queue .Op Fl f Ar file .Op Fl mldbv .Fl t Ar [[CC]YY]MMDDhhmm[.SS] .Nm at -.Op Fl V .Fl c Ar job Op Ar job ... .Nm at -.Op Fl V .Fl r Ar job Op Ar job ... .Pp .Nm atq -.Op Fl V .Op Fl q Ar queue .Op Fl v .Pp .Nm atrm -.Op Fl V .Ar job .Op Ar job ... .Pp .Nm batch -.Op Fl V .Op Fl q Ar queue .Op Fl f Ar file .Op Fl mv .Op Ar time .Sh DESCRIPTION .Nm \&At and .Nm batch read commands from standard input or a specified file which are to be executed at a later time, using .Xr sh 1 . .Bl -tag -width indent .It Nm at executes commands at a specified time; .It Nm atq lists the user's pending jobs, unless the user is the superuser; in that case, everybody's jobs are listed; .It Nm atrm deletes jobs; .It Nm batch executes commands when system load levels permit; in other words, when the load average drops below _LOADAVG_MX, or the value specified in the invocation of .Nm atrun . .El .Pp .Nm \&At allows some moderately complex .Ar time specifications. It accepts times of the form .Ar HHMM or .Ar HH:MM to run a job at a specific time of day. (If that time is already past, the next day is assumed.) -You may also specify +As an alternative, the following keywords may be specified: .Em midnight , .Em noon , or .Em teatime (4pm) -and you can have a time-of-day suffixed with +and time-of-day may be suffixed with .Em AM or .Em PM for running in the morning or the evening. -You can also say what day the job will be run, +The day on which the job is to be run may also be specified by giving a date in the form .Ar \%month-name day with an optional .Ar year , or giving a date of the forms .Ar DD.MM.YYYY , .Ar DD.MM.YY , .Ar MM/DD/YYYY , .Ar MM/DD/YY , .Ar MMDDYYYY , or .Ar MMDDYY . The specification of a date must follow the specification of the time of day. -You can also give times like +Time can also be specified as: .Op Em now .Em + Ar count \%time-units , where the time-units can be .Em minutes , .Em hours , .Em days , .Em weeks , .Em months or .Em years -and you can tell +and .Nm -to run the job today by suffixing the time with +may be told to run the job today by suffixing the time with .Em today and to run the job tomorrow by suffixing the time with .Em tomorrow . .Pp -For example, to run a job at 4pm three days from now, you would do +For example, to run a job at 4pm three days from now, use .Nm at Ar 4pm + 3 days , -to run a job at 10:00am on July 31, you would do +to run a job at 10:00am on July 31, use .Nm at Ar 10am Jul 31 -and to run a job at 1am tomorrow, you would do +and to run a job at 1am tomorrow, use .Nm at Ar 1am tomorrow . .Pp The .Nm at utility also supports the POSIX time format (see .Fl t option). .Pp For both .Nm and .Nm batch , commands are read from standard input or the file specified with the .Fl f option and executed. The working directory, the environment (except for the variables .Ev TERM , .Ev TERMCAP , .Ev DISPLAY and .Em _ ) and the .Ar umask are retained from the time of invocation. An .Nm or .Nm batch command invoked from a .Xr su 1 shell will retain the current userid. The user will be mailed standard error and standard output from his commands, if any. Mail will be sent using the command .Xr sendmail 8 . If .Nm is executed from a .Xr su 1 shell, the owner of the login shell will receive the mail. .Pp The superuser may use these commands in any case. For other users, permission to use .Nm is determined by the files .Pa _PERM_PATH/at.allow and .Pa _PERM_PATH/at.deny . .Pp If the file .Pa _PERM_PATH/at.allow exists, only usernames mentioned in it are allowed to use .Nm . .Pp If .Pa _PERM_PATH/at.allow does not exist, .Pa _PERM_PATH/at.deny is checked, every username not mentioned in it is then allowed to use .Nm Ns . .Pp If neither exists, only the superuser is allowed use of .Nm Ns . This is the default configuration. .Sh OPTIONS .Bl -tag -width indent -.It Fl V -Print the version number to standard error. .It Fl q Ar queue Use the specified queue. A queue designation consists of a single letter; valid queue designations range from .Ar a to .Ar z and .Ar A to .Ar Z . The .Ar _DEFAULT_AT_QUEUE queue is the default for .Nm and the .Ar _DEFAULT_BATCH_QUEUE queue for .Nm batch . Queues with higher letters run with increased niceness. If a job is submitted to a queue designated with an uppercase letter, it is treated as if it had been submitted to batch at that time. If .Nm atq is given a specific queue, it will only show jobs pending in that queue. .It Fl m Send mail to the user when the job has completed even if there was no output. .It Fl f Ar file Read the job from .Ar file rather than standard input. .It Fl l Is an alias for .Nm atq . .It Fl d Is an alias for .Nm atrm (this option is deprecated; use .Fl r instead). .It Fl b Is an alias for .Nm batch . .It Fl v For .Nm atq , shows completed but not yet deleted jobs in the queue; otherwise shows the time the job will be executed. .It Fl c Cat the jobs listed on the command line to standard output. .It Fl r Remove specified job(s). .It Fl t Specify the job time using the POSIX time format. The argument should be in the form .Dq [[CC]YY]MMDDhhmm[.SS] where each pair of letters represents the following: .Pp .Bl -tag -width Ds -compact -offset indent .It Ar CC The first two digits of the year (the century). .It Ar YY The second two digits of the year. .It Ar MM The month of the year, from 1 to 12. .It Ar DD the day of the month, from 1 to 31. .It Ar hh The hour of the day, from 0 to 23. .It Ar mm The minute of the hour, from 0 to 59. .It Ar SS The second of the minute, from 0 to 61. .El .Pp If the .Dq CC and .Dq YY letter pairs are not specified, the values default to the current year. If the .Dq SS letter pair is not specified, the value defaults to 0. .El .Sh FILES .Bl -tag -width _ATJOB_DIR/_LOCKFILE -compact .It Pa _ATJOB_DIR directory containing job files .It Pa _ATSPOOL_DIR directory containing output spool files .It Pa /var/run/utmp login records .It Pa _PERM_PATH/at.allow allow permission control .It Pa _PERM_PATH/at.deny deny permission control .It Pa _ATJOB_DIR/_LOCKFILE job-creation lock file .El .Sh SEE ALSO .Xr nice 1 , .Xr sh 1 , .Xr umask 2 , .Xr atrun 8 , .Xr cron 8 , .Xr sendmail 8 .Sh BUGS If the file .Pa /var/run/utmp is not available or corrupted, or if the user is not logged on at the time .Nm is invoked, the mail is sent to the userid found in the environment variable .Ev LOGNAME . If that is undefined or empty, the current userid is assumed. .Pp .Nm \&At and .Nm batch as presently implemented are not suitable when users are competing for resources. -If this is the case for your site, you might want to consider another -batch system, such as -.Em nqs . +If this is the case, another batch system such as +.Em nqs +may be more suitable. .Pp Specifying a date past 2038 may not work on some systems. .Sh AUTHORS At was mostly written by .An Thomas Koenig Aq ig25@rz.uni-karlsruhe.de . The time parsing routines are by .An David Parsons Aq orc@pell.chi.il.us , with minor enhancements by .An Joe Halpin Aq joe.halpin@attbi.com . Index: head/usr.bin/at/panic.c =================================================================== --- head/usr.bin/at/panic.c (revision 89632) +++ head/usr.bin/at/panic.c (revision 89633) @@ -1,90 +1,90 @@ /* * panic.c - terminate fast in case of error * Copyright (C) 1993 Thomas Koenig * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. The name of the author(s) may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); /* System Headers */ #include #include #include #include #include /* Local headers */ #include "panic.h" #include "privs.h" #include "at.h" /* External variables */ /* Global functions */ void panic(const char *a) { /* Something fatal has happened, print error message and exit. */ if (fcreated) { PRIV_START unlink(atfile); PRIV_END } errx(EXIT_FAILURE, "%s", a); } void perr(const char *a) { /* Some operating system error; print error message and exit. */ int serrno = errno; if (fcreated) { PRIV_START unlink(atfile); PRIV_END } errno = serrno; err(EXIT_FAILURE, "%s", a); } void usage(void) { /* Print usage and exit. */ - fprintf(stderr, "usage: at [-V] [-q x] [-f file] [-m] time\n" - " at [-V] -c job [job ...]\n" - " at [-V] [-f file] -t [[CC]YY]MMDDhhmm[.SS]\n" - " at [-V] -r job [job ...]\n" - " atq [-V] [-q x] [-v]\n" - " atrm [-V] job [job ...]\n" - " batch [-V] [-f file] [-m]\n"); + fprintf(stderr, "usage: at [-q x] [-f file] [-m] time\n" + " at -c job [job ...]\n" + " at [-f file] -t [[CC]YY]MMDDhhmm[.SS]\n" + " at -r job [job ...]\n" + " atq [-q x] [-v]\n" + " atrm job [job ...]\n" + " batch [-f file] [-m]\n"); exit(EXIT_FAILURE); }