- This topic is empty.
-
AuthorPosts
-
September 13, 2014 at 11:38 pm #182905
Ferron
ParticipantI’m using the Tumblr API PHP client and want to have it set up so that it grabs data from the API once every 24 hours and adds a record in a MySQL database. My question is, how would I go about doing a long-running process like that? I’ve looked into cron jobs but making it work through PHP seems kind of complicated. Is there any other alternative?
September 14, 2014 at 10:02 am #182957__
ParticipantCron jobs are way simple. There’s no need to start them through PHP (start them normally and have them call your php script).
Is this your own machine? a VPS? shared host? Do you have access to the terminal? Here’s the man page.
September 14, 2014 at 11:01 am #182963Ferron
ParticipantThanks for the link! I’m on a shared host right now and do have SSH access, but ideally I wouldn’t want manually set a cron job through the terminal. I’m trying to write a basic analytics script that would just display the number of followers so (at least I think) I should do that without touching the terminal but possibly not.
September 14, 2014 at 12:17 pm #182982__
Participantbut ideally I wouldn’t want manually set a cron job through the terminal.
If it’s just because you’re worried about the terminal, you should know that it’s much easier. I’ve seen a few different examples of control panels that shared hosts provide for cron, and they were all horrible to use.* And that’s if your host even has one (check your host’s help pages).
* …but trying to set it up from inside a php script is even worse. use your host’s CP (if available) or the terminal.
September 17, 2014 at 6:25 am #183373Ferron
ParticipantYeah, I am getting comfortable working in the terminal but the reason I don’t want to do it manually is because I kind of want this to scale, with multiple users and everything, and have it add a process automatically on registration (if I can). Manually adding it is fine for me but with multiple users registering I don’t think it would be viable.
September 17, 2014 at 7:39 am #183381__
ParticipantSure. Talk to your host.
I kind of want this to scale, with multiple users and everything, and have it add a process automatically on registration (if I can)
If I’m understanding you correctly, this is probably the wrong approach. It wouldn’t be efficient, and I really don’t think a shared host would be happy with you adding dozens of cron jobs.
Start one job, and do {whatever you’re doing} for each user from that one script.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.