fbpx

Category: Automation

Yesterday, I launched a PPC campaign for one of my services and added some tracking on my end.

As a developer I am supposed to be lazy so I decided to set up a regular cron job that will send me stats every few days.

The idea

I set up a cron job to call a given website every Monday, Wednesday & Friday at 8:30AM.

The output from that link needed to be sent to an email address.

The idea is to call a website which will generate some stats and those stats need to be emailed.
This is a huge time saving  because I don't have to login anywhere and the stats are conveniently delivered to my email address.

How I did it

Log into linux server or you can use your control panel's interface to set it.

[code]
crontab -e
[/code]

Add a cron job task

[code]
# Mon, Wed, Fri at 8:30am
30 08 * * 1,3,5 lynx --source 'http://example.com/?orbisius_gen_stats=1' 2>&1 | mail -a "Content-type: text/html" -s "CPC Report" 'reports@example.com'
[/code]

2>&1 is necessary so the output gets redirected from STDERR to STDOUT.

-s "CPC Report" <== this is the subject line.
If the app doesn't return the stats in HTML you can remove the following params:
-a "Content-type: text/html"
'reports@example.com' <== This is the recipient. Make sure you use your email address ;)

 

Related

  • http://stackoverflow.com/questions/31260837/how-to-run-a-cron-job-on-every-monday-wednesday-and-friday

Join our mailing list

Get important news about cool products we release and invitations to beta test new products

Find out the Social networks we're on