

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in net.sourceforge.lists.courier-users[courier-users] Patch - Mailq| From | Sent On | Attachments |
|---|---|---|
| Jérôme Blion | Jan 21, 2007 4:35 pm | |
| Alessandro Vesely | Jan 22, 2007 2:06 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | [courier-users] Patch - Mailq | Actions... |
|---|---|---|
| From: | Jérôme Blion (jero...@free.fr) | |
| Date: | Jan 21, 2007 4:35:57 pm | |
| List: | net.sourceforge.lists.courier-users | |
Hello,
I'm trying to patch mailq... I want to change the output format
I added the "-batch" option to do the following: - remove headers - put every data about a queue item on a same line So, the format in batch mode is:
size;qid;date;user;from;[status;recipient];[status;recipient];[status;recipient];[...];
So, excepted for the last line (I think I will remove it), I have a CSV-parseable file.
The patch is attached.
I'd need your help: - My queue is quite always empty. Could you provide me an output of mailq command with and without "-batch" option? - What's your feeling about this feature? How do you supervise your mail queues? - Bonus question: how to disable delivery process in order to fill my queue by myself?
Thank you for your help :-) Jerome Blion.
--- mailq.c.ori 2007-01-22 00:31:20.000000000 +0100 +++ mailq.c 2007-01-22 01:24:37.000000000 +0100 @@ -24,9 +24,11 @@
static const char *sortflag=0; +static const char *batchflag=0;
static struct courier_args arginfo[]={ {"sort", &sortflag}, + {"batch",&batchflag}, {0, 0}};
/* @@ -39,12 +41,20 @@
static void showqline(const char *a, const char *b, const char *c) { - if (c) - printf("%16s %-*s %s\n", a, - (int)(sizeof(ino_t)+sizeof(time_t)*2+sizeof(pid_t))*2+3, - b, c); - else - printf("%-16s %s\n", a, b); + if(batchflag) { + if(c) + printf("%s;%s;%s;", a, b, c); + else + printf("%s;%s;", a, b); + } + else { + if (c) + printf("%16s %-*s %s\n", a, + (int)(sizeof(ino_t)+sizeof(time_t)*2+sizeof(pid_t))*2+3, + b, c); + else + printf("%-16s %s\n", a, b); + } }
static void showq(struct ctlfile *ctf, struct stat *stat_buf) @@ -151,12 +161,15 @@ perror("topdirp"); exit(1); } - - showqline("Size ", "Queue ID", "Date"); - showqline("User", "From", 0); - showqline("Status", "Recipient", 0); - showqline("----------------", - "---------------------------------------------------------", 0); + + if(!batchflag) + { + showqline("Size ", "Queue ID", "Date"); + showqline("User", "From", 0); + showqline("Status", "Recipient", 0); + showqline("----------------", + "---------------------------------------------------------", 0); + }
while ((topdire=readdir(topdirp)) != 0) { @@ -258,6 +271,9 @@ } }
- printf("%4d messages.\n", qcount); + if(batchflag) + printf("messages: %d\n",qcount); + else + printf("%4d messages.\n", qcount); return (0); }







