I would like to set up a cron job to automatically send me an email with the current member list. I see that list_members is in the bin directory but I cant seem to get it to work via cron to send me the list. Does anyone know how to do this?

(I want to this so I get all members of the list as opposed to using the who command which only shows memebrs who do not have hide enabled.)


---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1?/min.

Search Discussions

  • Mark Sapiro at Sep 29, 2006 at 12:04 am

    David Boothe wrote:
    I would like to set up a cron job to automatically send me an email with the current member list. I see that list_members is in the bin directory but I cant seem to get it to work via cron to send me the list. Does anyone know how to do this?

    It should work.

    I'm guessing your issue is either permissions or getting the results
    mailed to the right place. In general, you may need to add the
    path/to/bin/list_members command to the crontab for the mailman user
    in order that it have permission to run. You can't put it in your own
    crontab unless you can run bin/list_members as you.

    Then you have the issue of mailing the result to you is the command is
    in Mailman's crontab. You may be able to put a
    'MAILTO=you at example.com' in the crontab, but that may not be desired
    because of where you want error output from other commands in the
    crontab to go. You may need to pipe the output from bin/list_members
    to something (e.g. /bin/mail you at example.com) that will mail it to you.

    --
    Mark Sapiro <msapiro at value.net> The highway is for gamblers,
    San Francisco Bay Area, California better use your sense - B. Dylan
  • David Boothe at Sep 29, 2006 at 3:00 am
    I habe the following set up as a cron job...

    /path/to/mailman/bin/list_members listname | mail -s 'List Names' box at address.com


    It sends the email to box at address.com but it is empty.


    Mark Sapiro wrote:
    David Boothe wrote:
    I would like to set up a cron job to automatically send me an email with the current member list. I see that list_members is in the bin directory but I cant seem to get it to work via cron to send me the list. Does anyone know how to do this?

    It should work.

    I'm guessing your issue is either permissions or getting the results
    mailed to the right place. In general, you may need to add the
    path/to/bin/list_members command to the crontab for the mailman user
    in order that it have permission to run. You can't put it in your own
    crontab unless you can run bin/list_members as you.

    Then you have the issue of mailing the result to you is the command is
    in Mailman's crontab. You may be able to put a
    'MAILTO=you at example.com' in the crontab, but that may not be desired
    because of where you want error output from other commands in the
    crontab to go. You may need to pipe the output from bin/list_members
    to something (e.g. /bin/mail you at example.com) that will mail it to you.

    --
    Mark Sapiro The highway is for gamblers,
    San Francisco Bay Area, California better use your sense - B. Dylan




    ---------------------------------
    Stay in the know. Pulse on the new Yahoo.com. Check it out.
  • Mark Sapiro at Sep 29, 2006 at 3:51 am

    David Boothe wrote:
    I habe the following set up as a cron job...

    /path/to/mailman/bin/list_members listname | mail -s 'List Names' box at address.com


    It sends the email to box at address.com but it is empty.

    In what users crontab? What happens if this user runs bin/list_members
    interactively?

    --
    Mark Sapiro <msapiro at value.net> The highway is for gamblers,
    San Francisco Bay Area, California better use your sense - B. Dylan
  • Anne Ramey at Sep 29, 2006 at 1:14 pm

    David Boothe wrote:

    I habe the following set up as a cron job...

    /path/to/mailman/bin/list_members listname | mail -s 'List Names' box at address.com

    It sends the email to box at address.com but it is empty.
    You might try
    /path/to/mailman/bin/list_members listname &> /path/to/mail -s 'List
    Names' box at address.com

    You may need to specify the path to the mail depending on what you have
    PATH= set to for your crontab. Also, I've never tried to | in cron.
    I'm sure it's possible, but &> redirects the output of a cron command to
    wherever you've specified.

    --
    Anne Ramey
  • Mark Sapiro at Sep 29, 2006 at 2:01 pm

    Anne Ramey wrote:
    You might try
    /path/to/mailman/bin/list_members listname &> /path/to/mail -s 'List
    Names' box at address.com

    This is shell dependent. &> doesn't work in all shells, but if it does,
    the effect of the above would be to write both stdout and stderr from
    the command

    /path/to/mailman/bin/list_members listname -s 'List Names'
    box at address.com

    to the file /path/to/mail (with luck, this would fail for lack of
    permission)
    You may need to specify the path to the mail depending on what you have
    PATH= set to for your crontab.

    The OP reported he received mail, so I don't think the path is the
    issue.

    Also, I've never tried to | in cron.
    I'm sure it's possible, but &> redirects the output of a cron command to
    wherever you've specified.

    cron passes the command line to the selected shell. If the shell
    recognizes | as a pipe it works.

    In bash for example &> redirects both stdout and stderr to a file (not
    to the stdin of a command), but in tcsh for example only >& does this,
    and &> doesn't work at all.

    To use &> in a cron command line, you'd need something like

    /path/to/mailman/bin/list_members listname &> /tmp/xxx ; mail -s 'List
    Names' box at address.com < /tmp/xxx ; rm /tmp/xxx

    for the command part.

    --
    Mark Sapiro <msapiro at value.net> The highway is for gamblers,
    San Francisco Bay Area, California better use your sense - B. Dylan

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmailman-users @
categoriespython
postedSep 28, '06 at 11:30p
activeSep 29, '06 at 2:01p
posts6
users3
websitelist.org

People

Translate

site design / logo © 2022 Grokbase