Home > database >  Crontab can only schedule for every minutes
Crontab can only schedule for every minutes

Time:09-24

So i want to try make a basic schedule with crontab, this is the basic script :

* * * * * date >> /home/clauds/crontab.log
* * * * * cp /home/clauds/ahmadbagas /home/clauds/bckup
* * * * * cp /home/clauds/masjayeng.txt /home/clauds/bckup

if i do it like that it works, but when i try to change to backup file for every 5 minutes or else it doesn't work:

5 * * * * date >> /home/clauds/crontab.log
2 * * * * cp /home/clauds/ahmadbagas /home/clauds/bckup
5 * * * * cp /home/clauds/masjayeng.txt /home/clauds/bckup

i try to add user in the command like this :

5 * * * * root date >> /home/clauds/crontab.log
2 * * * * root cp /home/clauds/ahmadbagas /home/clauds/bckup
5 * * * * root cp /home/clauds/masjayeng.txt /home/clauds/bckup

it's still doesn't work, and give a error message like this:

/bin/sh: root: command not found

can someone help me, why am i only can make schedule for everyminutes?

CodePudding user response:

*/5 * * * * date >> /home/clauds/crontab.log
*/2 * * * * cp /home/clauds/ahmadbagas /home/clauds/bckup
*/5 * * * * cp /home/clauds/masjayeng.txt /home/clauds/bckup

The second one will be every two minutes

  • Related