This is a discussion on [courier-users] Patch - Mailq within the Courier-Imap forums, part of the Mail Servers and Related category; This is a multi-part message in MIME format. --------------010106060404060301080303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
This is a multi-part message in MIME format.
--------------010106060404060301080303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------010106060404060301080303 Content-Type: text/plain; name="mailq.batch.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="mailq.batch.patch" --- 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); } --------------010106060404060301080303 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?p...rge&CID=DEVDEV --------------010106060404060301080303 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ courier-users mailing list courier-users@lists.sourceforge.net Unsubscribe: https://lists.sourceforge.net/lists/.../courier-users --------------010106060404060301080303-- |
![]() |
| Thread Tools | |
| Display Modes | |
|
|