How to execute bash script automatically at specific interval?

You should add it as an entry in your crontab:

crontab -e

Then you must add something like this:

* * * * * /path/to/command arg1 arg2
- - - - -
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)

For example, this will execute a script every day at 3 AM:

0 3 * * * /home/MyUser/MyCrons/myScript.sh

Now, if you don't want it to run at specific hour, but every X minutes/hours or whatever, you can do something like this:

*/5 * * * * /path/to/your/script

That would make it run every 5 minutes.

You can list your cron jobs with:

crontab -l

Or if you want to see the cron jobs of a particular user:

crontab -l -u USERNAME

You could use crontab. It is a time based job scheduler. I use it to schedule my backups.

50 18 * * * /mydir/subdir/somebashscript.sh

It looks something like this. The 50 is minutes(0-59), the 18 is the hour of the day(0-23), then it goes days of the month(1-31), months of the year(1-12), and the last is days of the week(0-6).