I have a website that runs off a Node web server, a Redis server for temporary storage, and a Postgres database. Once a day, I would like to run a batch of Redis and Postgres queries to generate a daily report of key usage statistics, tabulate the results, and distribute this report via email. I'm wondering what is a recommended way to:
a) execute multiple Redis and Postgres queries, tabulate the results, and email them out.
b) reliably run the above script on a fixed schedule, say every 24 hours, in a Linux environment (specifically, I'm running the Amazon Linux AMI).
I'm coming from a web development background, so my initial instinct for part (a) is to write a separate Node program that performs all these tasks in succession. Is that all there is to it, or is there a better way?