Automatically Run a Command Every 5 Minutes

You can use

crontab -e

to create a user cron schedule.

The line you specifically need is

*/5 * * * * /home/YOU/backup.sh

In backup.sh add any commands you want to run, make sure the script is executable, i.e. chmod +x backup.sh

Have a look at

http://www.unixgeeks.org/security/newbie/unix/cron-1.html


Easy Method

You can set up a bash script that loops forever executing that command then sleeping for 5 minutes.

Open a terminal and execute this command:

sudo nano /usr/local/bin/amazon-sync

Then, type the following:

#!/bin/sh  
while true  
do  
  acd_cli sync  
  sleep 300  
done

Press ctrl+o to save

Press ctrl+x to exit

Execute this command:

sudo chmod +x /usr/local/bin/amazon-sync  

When you start up your computer press ctrl+alt+t and type amazon-sync then minimize the terminal window. Command will run once every 5 minutes (300 seconds).


There's also watch command, if you need to show output on screen and clear automatically.

watch -n 300 acd_cli sync

Tags:

Command Line