How to do a cron job

I have a lot of cron jobs that’s been running on a web site at but all of a sudden they are all gone!!!
I don’t remember all of them and I don’t remember the correct code to make one php file to run.
They can’t help me and tell me to ask in a forum or talk to a programmer or whatever… Not good at all!!! I didn’t remove them.

Is there anyone who can help me what the command line should look like to run the file todo.php in my folder called cron?

This is what I tried so far, but they don’t work:
php -q /home2/username/public_html/cron/todo.php


php /home2/username/public_html/cron/todo.php

Cron will simply run those commands as though you typed them into the command line. So what happens if you run them in the command line?

Yes, some cron jobs will run without doing anything that you will notice, so it may have run. Try adding a job or altering a job to do something that you will see, for example, send you an Email.

The easist way - write your question to your hosting support.

Well, I wrote the question to my hosting support (like I wrote in my text). They told me to ask in a forum or talk to a programmer…

So, when putting a command to send me an e-mail. Would this simply be:

1 Like

After a while I found the code and it seems to be working now:
/usr/local/bin/php -q //home2/username/public_html/cron/filename.php

Why do they even claim to offer support?

To send an Email from PHP try something like this:

mail($toaddress, $subject, $message, $headers);

A lot of hosting providers have that function turned off and require you to send emails via authenticated SMTP instead.

I had HostMonster years ago and had nothing but problems. As soon as the two year contract was up I moved on.