Jump to content


[Solved] Create a cron job

cron jobs

  • Please log in to reply
3 replies to this topic

#1 micasa52



  • Members
  • 2 posts

Posted 01 March 2020 - 11:00 PM



I want to create a cron job to execute a php file every day at 12am. I donĀ“t know wich comand to write to do this.

Can you help me?


Thank you.

#2 wolstech


    Rank X Member

  • Root Admin
  • 11,887 posts
  • Gender:Male
  • Location:Pennsylvania

Posted 01 March 2020 - 11:41 PM

Use something like this (you can replace the numbers in ea-php56 to change PHP versions, 54, 55, 56, 70, 71, 72 are supported.)

ea-php56 -q /home/username/path/to/file.php

Also, I would suggest not running right at midnight for load reasons. If you need it run around that time, set it for a few minutes before or after (e.g. 0:06 or 23:57)

Please do not PM me for support. Posting on our forums lets all of us learn.
Do you play Minecraft? | Server Monitors | And the Dumbass of the Decade award goes to...

#3 micasa52



  • Members
  • 2 posts

Posted 24 March 2020 - 10:08 AM

Hello again!!


The cron job is working but not well. I have a php page with an activity that send some emails with attachment to some email directions. The activity works fine when I execute from a web page. From the crob job the same activity only send an email without that attachment. There's the cron job any limitaton?


Thak you so much!

#4 Krydos


    Rank X Member

  • Root Admin
  • 19,663 posts
  • Gender:Male

Posted 24 March 2020 - 03:40 PM

When I ran the command manually it took about 30 seconds to finish and that was with Johnny's load at only 4. Php scripts have a maximum time that they can run, and if they exceed the limit they are killed. I wouldn't surprise me at all if the load was high on Johnny when your cron tried to run, and it was so slow that it timed out before finishing everything.

I'm sure you've heard the spiel before, but Johnny isn't a production server. We only recommend using Johnny until you're done experimenting and then move to a better server. Ricky has good uptime, but Tommy is considerably faster. Free signups for Ricky start at midnight UTC and usually fills in about 5 minutes. Tommy free signups also start at midnight UTC, and usually fill in about 5 seconds. If you're interested in switching servers an admin can move your account for you if you're a donor. Otherwise the process to switch servers is 1) backup 2) delete the Johnny account 3) hope you're fast enough to snag a production server slot, and 4) restore your backup.

Also tagged with one or more of these keywords: cron jobs

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users