|
|
4e3b3d |
diff -up at-3.1.13/at.1.in.nit at-3.1.13/at.1.in
|
|
|
4e3b3d |
--- at-3.1.13/at.1.in.nit 2011-06-25 14:43:14.000000000 +0200
|
|
|
4e3b3d |
+++ at-3.1.13/at.1.in 2011-07-28 13:04:41.398174737 +0200
|
|
|
4e3b3d |
@@ -126,7 +126,7 @@ and to run a job at 1am tomorrow, you wo
|
|
|
4e3b3d |
.B at 1am tomorrow.
|
|
|
4e3b3d |
.PP
|
|
|
4e3b3d |
The definition of the time specification can be found in
|
|
|
4e3b3d |
-.IR @prefix@/share/doc/at/timespec .
|
|
|
4e3b3d |
+.IR @prefix@/share/doc/at-@VERSION@/timespec .
|
|
|
4e3b3d |
.PP
|
|
|
4e3b3d |
For both
|
|
|
4e3b3d |
.BR at " and " batch ,
|
|
|
4e3b3d |
@@ -204,7 +204,7 @@ queue for
|
|
|
4e3b3d |
.BR batch .
|
|
|
4e3b3d |
Queues with higher letters run with increased niceness. The special
|
|
|
4e3b3d |
queue "=" is reserved for jobs which are currently running.
|
|
|
4e3b3d |
-.P
|
|
|
4e3b3d |
+
|
|
|
4e3b3d |
If a job is submitted to a queue designated with an uppercase letter, the
|
|
|
4e3b3d |
job is treated as if it were submitted to batch at the time of the job.
|
|
|
4e3b3d |
Once the time is reached, the batch processing rules with respect to load
|
|
|
4e3b3d |
@@ -248,7 +248,7 @@ is an alias for
|
|
|
4e3b3d |
.TP
|
|
|
4e3b3d |
.B \-v
|
|
|
4e3b3d |
Shows the time the job will be executed before reading the job.
|
|
|
4e3b3d |
-.P
|
|
|
4e3b3d |
+
|
|
|
4e3b3d |
Times displayed will be in the format "Thu Feb 20 14:50:00 1997".
|
|
|
4e3b3d |
.TP
|
|
|
4e3b3d |
.B
|
|
|
4e3b3d |
diff -up at-3.1.13/atd.c.nit at-3.1.13/atd.c
|
|
|
4e3b3d |
--- at-3.1.13/atd.c.nit 2011-06-25 14:43:14.000000000 +0200
|
|
|
4e3b3d |
+++ at-3.1.13/atd.c 2011-07-28 13:01:31.577967025 +0200
|
|
|
4e3b3d |
@@ -83,6 +83,9 @@
|
|
|
4e3b3d |
#include "getloadavg.h"
|
|
|
4e3b3d |
#endif
|
|
|
4e3b3d |
|
|
|
4e3b3d |
+#ifndef LOG_ATD
|
|
|
4e3b3d |
+#define LOG_ATD LOG_DAEMON
|
|
|
4e3b3d |
+#endif
|
|
|
4e3b3d |
/* Macros */
|
|
|
4e3b3d |
|
|
|
4e3b3d |
#define BATCH_INTERVAL_DEFAULT 60
|
|
|
4e3b3d |
@@ -194,6 +197,18 @@ myfork()
|
|
|
4e3b3d |
|
|
|
4e3b3d |
#define fork myfork
|
|
|
4e3b3d |
#endif
|
|
|
4e3b3d |
+#undef ATD_MAIL_PROGRAM
|
|
|
4e3b3d |
+#undef ATD_MAIL_NAME
|
|
|
4e3b3d |
+#if defined(SENDMAIL)
|
|
|
4e3b3d |
+#define ATD_MAIL_PROGRAM SENDMAIL
|
|
|
4e3b3d |
+#define ATD_MAIL_NAME "sendmail"
|
|
|
4e3b3d |
+#elif defined(MAILC)
|
|
|
4e3b3d |
+#define ATD_MAIL_PROGRAM MAILC
|
|
|
4e3b3d |
+#define ATD_MAIL_NAME "mail"
|
|
|
4e3b3d |
+#elif defined(MAILX)
|
|
|
4e3b3d |
+#define ATD_MAIL_PROGRAM MAILX
|
|
|
4e3b3d |
+#define ATD_MAIL_NAME "mailx"
|
|
|
4e3b3d |
+#endif
|
|
|
4e3b3d |
|
|
|
4e3b3d |
static void
|
|
|
4e3b3d |
run_file(const char *filename, uid_t uid, gid_t gid)
|
|
|
4e3b3d |
@@ -271,6 +286,9 @@ run_file(const char *filename, uid_t uid
|
|
|
4e3b3d |
free(newname);
|
|
|
4e3b3d |
return;
|
|
|
4e3b3d |
}
|
|
|
4e3b3d |
+
|
|
|
4e3b3d |
+ (void) setsid(); //own session for process
|
|
|
4e3b3d |
+
|
|
|
4e3b3d |
/* Let's see who we mail to. Hopefully, we can read it from
|
|
|
4e3b3d |
* the command file; if not, send it to the owner, or, failing that,
|
|
|
4e3b3d |
* to root.
|
|
|
4e3b3d |
@@ -433,6 +451,9 @@ run_file(const char *filename, uid_t uid
|
|
|
4e3b3d |
if (setuid(uid) < 0)
|
|
|
4e3b3d |
perr("Cannot set user id");
|
|
|
4e3b3d |
|
|
|
4e3b3d |
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
|
|
4e3b3d |
+ perr("Cannot reset signal handler to default");
|
|
|
4e3b3d |
+
|
|
|
4e3b3d |
chdir("/");
|
|
|
4e3b3d |
|
|
|
4e3b3d |
if (execle("/bin/sh", "sh", (char *) NULL, nenvp) != 0)
|
|
|
4e3b3d |
@@ -501,6 +522,9 @@ run_file(const char *filename, uid_t uid
|
|
|
4e3b3d |
if (setuid(uid) < 0)
|
|
|
4e3b3d |
perr("Cannot set user id");
|
|
|
4e3b3d |
|
|
|
4e3b3d |
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
|
|
4e3b3d |
+ perr("Cannot reset signal handler to default");
|
|
|
4e3b3d |
+
|
|
|
4e3b3d |
chdir ("/");
|
|
|
4e3b3d |
|
|
|
4e3b3d |
#if defined(SENDMAIL)
|
|
|
4e3b3d |
@@ -615,6 +639,7 @@ run_loop()
|
|
|
4e3b3d |
* Let's remove the lockfile and reschedule.
|
|
|
4e3b3d |
*/
|
|
|
4e3b3d |
strncpy(lock_name, dirent->d_name, sizeof(lock_name));
|
|
|
4e3b3d |
+ lock_name[sizeof(lock_name)-1] = '\0';
|
|
|
4e3b3d |
lock_name[0] = '=';
|
|
|
4e3b3d |
unlink(lock_name);
|
|
|
4e3b3d |
next_job = now;
|
|
|
4e3b3d |
@@ -649,6 +674,7 @@ run_loop()
|
|
|
4e3b3d |
run_batch++;
|
|
|
4e3b3d |
if (strcmp(batch_name, dirent->d_name) > 0) {
|
|
|
4e3b3d |
strncpy(batch_name, dirent->d_name, sizeof(batch_name));
|
|
|
4e3b3d |
+ batch_name[sizeof(batch_name)-1] = '\0';
|
|
|
4e3b3d |
batch_uid = buf.st_uid;
|
|
|
4e3b3d |
batch_gid = buf.st_gid;
|
|
|
4e3b3d |
batch_queue = queue;
|
|
|
4e3b3d |
@@ -723,11 +749,7 @@ main(int argc, char *argv[])
|
|
|
4e3b3d |
|
|
|
4e3b3d |
RELINQUISH_PRIVS_ROOT(daemon_uid, daemon_gid)
|
|
|
4e3b3d |
|
|
|
4e3b3d |
-#ifndef LOG_CRON
|
|
|
4e3b3d |
-#define LOG_CRON LOG_DAEMON
|
|
|
4e3b3d |
-#endif
|
|
|
4e3b3d |
-
|
|
|
4e3b3d |
- openlog("atd", LOG_PID, LOG_CRON);
|
|
|
4e3b3d |
+ openlog("atd", LOG_PID, LOG_ATD);
|
|
|
4e3b3d |
|
|
|
4e3b3d |
opterr = 0;
|
|
|
4e3b3d |
errno = 0;
|