Cancel loop/script in progress on server

Asked

Viewed 583 times

-5

Good morning, how to cancel an Infinite Loop in the Script that is already running on the server?

It was a routine I created to trigger emails, but by carelessness it is in infinite loop and the process does not stop.

It is already in progress on the server, and I wanted it to stop running, how do I interrupt the script?

  • 1

    Who script is this? Who executes, a CRON? Post more information, more details...already tried to give a restart in the apache?

  • I will try to re-start the server and check if it stops and give a feedback

  • @Kennyrafael Resolved giving Restart, was worth the answer!

  • 1

    Need more details! Running on Windows or Linux? Where’s the code? How do you know it’s running?

  • @Wallacemaxters why talk like that ? It sounds like he’s screaming... The guy’s already solved.

  • 1

    @Gumball I ask why so much mimimi? I’m not screaming. It was just an exclamation sign. The question is not clear at all, and the person who answered practically "kicked". It is impossible to give a complete answer to an incomplete question.

  • @Wallacemaxters I knew it was running because it was sending emails every second over and over. You wrote in right tone, really it was a desperate occasion. kkkkk.. grateful for the interest, would have helped me.

  • @Alexandrec.Caus welcome to Stackoverflow. My exclamation had no "evil intentions". Is that the site needs to have enough details in the question to help you (and also help other people, because if it is well described, other people will find your problem and will have the solution when looking at your question).

  • 1

    @Alexandrec.Caus see that PHP may have already stopped, but the server has the emails in the output queue. Don’t necessarily stop sending once you finish the script. But if the situation is very critical and you are close to the server physically, you always have a plan b :P http://i.stack.Imgur.com/etDFj.jpg

  • @Bacco Great his explanation, but as he had given a rest of 1s(Sleep) it did not occur. Fortunately, if it would not have bigger problems.

  • 1

    @Alexandrec.Caus may want to limit your script to fixed batches, and call in CRON (or task scheduler if it’s in Windows). There’s a lot of questions on the website about that if you need to.

  • 1

    Are you talking about long Polling? Or a process that has nothing to do with PHP, but would you like to control via php? See if this makes sense http://answall.com/a/127477/3635. Note: I am not negative, but if you detail the answer I can vote to reopen.

Show 7 more comments

1 answer

2


If this program has entered an infinite loop in an unwanted way, you can kill the responsible process through the command kill PID, where PID is the id of the referred process. To find out the PID, simply list the current processes (I believe it is with the command ps).

  • Thank you for your answer Anderson, you will be in the favorites. But it seems that I solved otherwise, giving Restart on the server, the loop will send emails, ai já viu ne.. I couldn’t waste a little more time.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.