micasa52 Posted March 1, 2020 Posted March 1, 2020 Hello. 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.
wolstech Posted March 1, 2020 Posted March 1, 2020 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)
micasa52 Posted March 24, 2020 Author Posted March 24, 2020 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!
Krydos Posted March 24, 2020 Posted March 24, 2020 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now