Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't make crontab work

I am new to Linux and Ubuntu and I seldom have to use it. I am trying to make this PHP script to run every minute using cron, but firstly I wanted to make some tests.

I created an empty file at /var/www/html/ called test. I ran on terminal:

sudo crontab -e

And added this line:

0 * * * * rm /var/www/html/test

Then saved it and exited. It said "Installing new Crontab"

Nothing happened. Then I created a file bfile.sh that contained:

#!/bin/sh 
rm /var/www/html/test

and added the following to crontab:

0 * * * * bash /var/www/html/bfile.sh

Still nothing happened.

What do I have to do to see anything happening from crontab? By the way I checked and the service is running

like image 358
Victor Ferreira Avatar asked Apr 19 '26 00:04

Victor Ferreira


1 Answers

0 * * * * basically says "run this at 0th minute of every hour."

If you need cron to run your command every minute do * * * * *.

like image 92
Maxim Egorushkin Avatar answered Apr 21 '26 16:04

Maxim Egorushkin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!