Cron job for hourly spam reports

Discussion in 'Mail Gateway: Installation and configuration' started by ihtxam, Dec 3, 2018.

  1. ihtxam

    ihtxam New Member

    Joined:
    Dec 3, 2018
    Messages:
    5
    Likes Received:
    0
    I am new to pm gw, i run this command as per this thread, post#10, and found following error:


    root@pmg:~# crontab -e 0 8-18 * * 1-5 /usr/bin/pmgqm send
    crontab: usage error: no arguments permitted after this option
    usage: crontab [-u user] file
    crontab [ -u user ] [ -i ] { -e | -l | -r }
    (default operation is replace, per 1003.2)
    -e (edit user's crontab)
    -l (list user's crontab)
    -r (delete user's crontab)
    -i (prompt before deleting user's crontab)


    Anybody can help on it please? thank you so much for replying soon.

    Kind regards,
    ihtxam
     
  2. rhonda

    rhonda Proxmox Staff Member
    Staff Member

    Joined:
    Sep 3, 2018
    Messages:
    25
    Likes Received:
    3
    You need to put the crontab entry into the file, it's not part of the commandline. "crontab -e" opens an editor, and in there you add the data you need.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. ihtxam

    ihtxam New Member

    Joined:
    Dec 3, 2018
    Messages:
    5
    Likes Received:
    0
    Thank you so much for your reply.

    I figured it out how to use nano editor and add cron.

    I actually copied following:

    0 8-18 * * 1-5 /usr/bin/pmgqm send

    Every hour between 8am and 6pm from monday to friday.
    And if the spam section is empty you get no mail.


    Can you please help, if i want this report to be send 24 hours, and every day of the week? how that would look like?
    After doing it, i would like to check if cron is working or no.

    thank you so much for quick reply.
     
    #3 ihtxam, Dec 3, 2018
    Last edited: Dec 3, 2018
  4. rhonda

    rhonda Proxmox Staff Member
    Staff Member

    Joined:
    Sep 3, 2018
    Messages:
    25
    Likes Received:
    3
    The way the crontab entries work is described in its manpage ("man 5 crontab"). I'm uncertain what you mean "to be send 24 hours", do you mean hourly? For that there is even a shortcut, "@hourly", as described in the manpage:

    @hourly /usr/bin/pmgqm send

    Hope that helps, the manpage is quite good and helpful. :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice