Cron job for hourly spam reports

ihtxam

New Member
Dec 3, 2018
7
0
1
42
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
 
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.
 
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.
 
Last edited:
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. :)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!