2022-02-22 16:01:05 +00:00
|
|
|
diff -ur b/at.1.in a/at.1.in
|
|
|
|
--- b/at.1.in 2022-01-29 17:42:19.000000000 +0100
|
|
|
|
+++ a/at.1.in 2022-02-22 15:19:47.598996428 +0100
|
|
|
|
@@ -226,7 +226,7 @@
|
|
|
|
.BR batch .
|
|
|
|
Queues with higher letters run with increased niceness. The special
|
|
|
|
queue "=" is reserved for jobs which are currently running.
|
|
|
|
-.P
|
|
|
|
+
|
|
|
|
If a job is submitted to a queue designated with an uppercase letter, the
|
|
|
|
job is treated as if it were submitted to batch at the time of the job.
|
|
|
|
Once the time is reached, the batch processing rules with respect to load
|
|
|
|
diff -ur b/atd.c a/atd.c
|
|
|
|
--- b/atd.c 2022-02-22 15:14:02.736336912 +0100
|
|
|
|
+++ a/atd.c 2022-02-22 15:19:02.163909540 +0100
|
|
|
|
@@ -197,6 +197,18 @@
|
2013-12-04 10:45:09 +00:00
|
|
|
|
|
|
|
#define fork myfork
|
|
|
|
#endif
|
|
|
|
+#undef ATD_MAIL_PROGRAM
|
|
|
|
+#undef ATD_MAIL_NAME
|
|
|
|
+#if defined(SENDMAIL)
|
|
|
|
+#define ATD_MAIL_PROGRAM SENDMAIL
|
|
|
|
+#define ATD_MAIL_NAME "sendmail"
|
|
|
|
+#elif defined(MAILC)
|
|
|
|
+#define ATD_MAIL_PROGRAM MAILC
|
|
|
|
+#define ATD_MAIL_NAME "mail"
|
|
|
|
+#elif defined(MAILX)
|
|
|
|
+#define ATD_MAIL_PROGRAM MAILX
|
|
|
|
+#define ATD_MAIL_NAME "mailx"
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
#ifdef WITH_SELINUX
|
2016-03-23 14:24:03 +00:00
|
|
|
static int
|
2022-02-22 16:01:05 +00:00
|
|
|
@@ -340,6 +352,9 @@
|
2013-12-04 10:45:09 +00:00
|
|
|
free(newname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ (void) setsid(); /* own session for process */
|
|
|
|
+
|
|
|
|
/* Let's see who we mail to. Hopefully, we can read it from
|
|
|
|
* the command file; if not, send it to the owner, or, failing that,
|
|
|
|
* to root.
|
2022-02-22 16:01:05 +00:00
|
|
|
@@ -508,6 +523,9 @@
|
2013-12-04 10:45:09 +00:00
|
|
|
if (setuid(uid) < 0)
|
|
|
|
perr("Cannot set user id");
|
|
|
|
|
2022-02-22 16:01:05 +00:00
|
|
|
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
2013-12-04 10:45:09 +00:00
|
|
|
+ perr("Cannot reset signal handler to default");
|
|
|
|
+
|
|
|
|
chdir("/");
|
|
|
|
|
|
|
|
execle("/bin/sh", "sh", (char *) NULL, nenvp);
|
2022-02-22 16:01:05 +00:00
|
|
|
@@ -573,6 +591,9 @@
|
2013-12-04 10:45:09 +00:00
|
|
|
if (setuid(uid) < 0)
|
|
|
|
perr("Cannot set user id");
|
|
|
|
|
2022-02-22 16:01:05 +00:00
|
|
|
+ if (SIG_ERR == signal(SIGCHLD, SIG_DFL))
|
2013-12-04 10:45:09 +00:00
|
|
|
+ perr("Cannot reset signal handler to default");
|
|
|
|
+
|
|
|
|
chdir ("/");
|
|
|
|
|
|
|
|
#if defined(SENDMAIL)
|
2022-02-22 16:01:05 +00:00
|
|
|
@@ -707,6 +728,7 @@
|
2013-12-04 10:45:09 +00:00
|
|
|
* Let's remove the lockfile and reschedule.
|
|
|
|
*/
|
|
|
|
strncpy(lock_name, dirent->d_name, sizeof(lock_name));
|
2022-02-22 16:01:05 +00:00
|
|
|
+ lock_name[sizeof(lock_name)-1] = '\0';
|
2013-12-04 10:45:09 +00:00
|
|
|
lock_name[0] = '=';
|
|
|
|
unlink(lock_name);
|
|
|
|
next_job = now;
|
2022-02-22 16:01:05 +00:00
|
|
|
@@ -741,6 +763,7 @@
|
2013-12-04 10:45:09 +00:00
|
|
|
run_batch++;
|
|
|
|
if (strcmp(batch_name, dirent->d_name) > 0) {
|
|
|
|
strncpy(batch_name, dirent->d_name, sizeof(batch_name));
|
2022-02-22 16:01:05 +00:00
|
|
|
+ batch_name[sizeof(batch_name)-1] = '\0';
|
2013-12-04 10:45:09 +00:00
|
|
|
batch_uid = buf.st_uid;
|
|
|
|
batch_gid = buf.st_gid;
|
|
|
|
batch_queue = queue;
|