Backport mails with hostname.
This commit is contained in:
parent
8c0170ef17
commit
9b663b75a8
62
at-3.1.14-mailwithhostname.patch
Normal file
62
at-3.1.14-mailwithhostname.patch
Normal file
@ -0,0 +1,62 @@
|
||||
diff -up at-3.1.14/atd.c.mail at-3.1.14/atd.c
|
||||
--- at-3.1.14/atd.c.mail 2013-12-02 10:47:06.000000000 +0100
|
||||
+++ at-3.1.14/atd.c 2013-12-02 10:51:23.000000000 +0100
|
||||
@@ -100,6 +100,10 @@ int selinux_enabled=0;
|
||||
#define BATCH_INTERVAL_DEFAULT 60
|
||||
#define CHECK_INTERVAL 3600
|
||||
|
||||
+#ifndef MAXHOSTNAMELEN
|
||||
+#define MAXHOSTNAMELEN 64
|
||||
+#endif
|
||||
+
|
||||
/* Global variables */
|
||||
|
||||
uid_t real_uid, effective_uid;
|
||||
@@ -117,6 +121,7 @@ static time_t last_chg;
|
||||
static int nothing_to_do;
|
||||
unsigned int batch_interval;
|
||||
static int run_as_daemon = 0;
|
||||
+static int mail_with_hostname = 0;
|
||||
|
||||
static volatile sig_atomic_t term_signal = 0;
|
||||
|
||||
@@ -298,6 +303,7 @@ run_file(const char *filename, uid_t uid
|
||||
char fmt[64];
|
||||
unsigned long jobno;
|
||||
int rc;
|
||||
+ char hostbuf[MAXHOSTNAMELEN];
|
||||
#ifdef WTIH_PAM
|
||||
int retcode;
|
||||
#endif
|
||||
@@ -452,6 +458,11 @@ run_file(const char *filename, uid_t uid
|
||||
|
||||
write_string(fd_out, "Subject: Output from your job ");
|
||||
write_string(fd_out, jobbuf);
|
||||
+ if (mail_with_hostname > 0) {
|
||||
+ gethostname(hostbuf, MAXHOSTNAMELEN-1);
|
||||
+ write_string(fd_out, " ");
|
||||
+ write_string(fd_out, hostbuf);
|
||||
+ }
|
||||
write_string(fd_out, "\nTo: ");
|
||||
write_string(fd_out, mailname);
|
||||
write_string(fd_out, "\n\n");
|
||||
@@ -872,7 +883,7 @@ main(int argc, char *argv[])
|
||||
run_as_daemon = 1;
|
||||
batch_interval = BATCH_INTERVAL_DEFAULT;
|
||||
|
||||
- while ((c = getopt(argc, argv, "sdl:b:f")) != EOF) {
|
||||
+ while ((c = getopt(argc, argv, "sdnl:b:f")) != EOF) {
|
||||
switch (c) {
|
||||
case 'l':
|
||||
if (sscanf(optarg, "%lf", &load_avg) != 1)
|
||||
@@ -894,6 +905,10 @@ main(int argc, char *argv[])
|
||||
daemon_foreground++;
|
||||
break;
|
||||
|
||||
+ case 'n':
|
||||
+ mail_with_hostname=1;
|
||||
+ break;
|
||||
+
|
||||
case 's':
|
||||
run_as_daemon = 0;
|
||||
break;
|
4
at.spec
4
at.spec
@ -25,7 +25,7 @@ Patch5: at-3.1.14-shell.patch
|
||||
Patch6: at-3.1.14-nitpicks.patch
|
||||
Patch7: at-3.1.14-nowrap.patch
|
||||
Patch8: at-3.1.14-fix_no_export.patch
|
||||
#Patch9: at-3.1.13-mailwithhostname.patch
|
||||
Patch9: at-3.1.14-mailwithhostname.patch
|
||||
#Patch10: at-3.1.13-usePOSIXtimers.patch
|
||||
#Patch11: at-3.1.13-help.patch
|
||||
|
||||
@ -79,7 +79,7 @@ cp %{SOURCE1} .
|
||||
%patch7 -p1 -b .nowrap
|
||||
%patch8 -p1 -b .export
|
||||
|
||||
#%%patch9 -p1 -b .mail
|
||||
%patch9 -p1 -b .mail
|
||||
#%%patch10 -p1 -b .posix
|
||||
#%%patch11 -p1 -b .help
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user