First, I would recommend you go get Ola Hallengren's backup scripts. They are full featured and well documented, supporting exactly the type of operations you are looking to complete. This saves you a lot of effort of writing your own scripts from scratch and the solution is recommended by many notables in the community.
Second, I would create SQL Agent jobs to call the backup stored procedures, with the following jobs:
- Full backup job that runs weekly, creating full backups for all databases. For argument's sake, this is at 2 AM Sunday.
- Differential backup job that runs on all days other than the day of the full. This would be 2 AM Monday-Saturday.
- Log backup job that executes every 5 minutes.
This is a very basic and general schedule and you will probably need to tweak and adjust it based on your environment. The largest area of adjustment will probably be how often you run your log backups. Depending on the size, activity, the number of databases in
FULL recovery mode, and the fact that this approach backs up your databases serially (one after the other), all log backups on your instance may not complete in 5 minutes. There are several ways to handle this, such as increasing the window between log backups and creating different backup jobs for different databases (so you can have them execute in parallel).