0

I have configured cron job but it's not working. I wanted to run the myfile.sh script for every 2 mint and below are my configuration in crontab.

# m h  dom mon dow   comman 
2 * * * * /home/ubuntu/myfile.sh

myfile.sh is executable and contains below lines of code

#!/bin/bash
mysqldump -u[user] -p[password] --single-transaction --routines --triggers --all-databases > /home/ubuntu/backup_db10.sql

Is there anywhere we need to add configure anything?

Jaff_NL
  • 73
  • 5
  • Possible duplicate of [How to run a cronjob every X minutes?](https://stackoverflow.com/questions/25740573/how-to-run-a-cronjob-every-x-minutes) – char Oct 28 '19 at 08:22
  • Just an update. You can replace the mysqldump with the full path "/usr/bin/mysqldump". – Harijith R Oct 28 '19 at 11:12

1 Answers1

0

You're running the script at two minutes past every hour. As in 1:02, 2:02 and so on.

You can change it to something like

*/2 * * * * /home/ubuntu/myfile.sh

to run it every two minutes.

A bit more info can be found here.

char
  • 2,063
  • 3
  • 15
  • 26