Cronjobbing n the Cloud

I’m super pleased with getting cogdogblog.com hoisted to the cloud, and I admit I have no good clue how everything works.

On my shared host version, I had set up a cron job o regularly delete comments flagged as spam from my database, keeping it clean from cruft. My cronjob command was:

mysql -u blog -p{password} --database={dbname} -Bse "DELETE FROM wp_comments WHERE comment_approved = 'spam'"

Can I do something like this in the clouds?

Yes absolutely!

You can open a terminal in the environment on Reclaim Cloud, then:

crontab -e

To edit the cron just like most linux boxes, or if you want to avoid the terminal or vim, you can do it from the “config” tool on Reclaim Cloud. Click on the wrench, then the cron bookmark in the sidebar, then double click on litespeed to edit that file.

You will need to use cron expressions for the scheduling (check out https://crontab.guru for help!) so stuff like this will work:

Delete the spam daily:

@daily mysql -u blog -p{password} --database={dbname} -Bse "DELETE FROM wp_comments WHERE comment_approved = 'spam'"

Delete the spam at 6am every Monday:

0 6 * * 1 mysql -u blog -p{password} --database={dbname} -Bse "DELETE FROM wp_comments WHERE comment_approved = 'spam'"