damerit Posted August 21, 2008 Share Posted August 21, 2008 Help!! I'm running apache server and php and I had an e-mail script loop through a cycle of events. Well I have been getting 4 to 5 e-mails every 35 to 60 minutes for the last 72 hours. Question? How do I stop the e-mails? I have removed the script and they seem to still be sending out. They are in a spool or que backed up somewhere but I'm not sure how or where. Can someone please assist? sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/ Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 i would ssh onto the server, then ps -aux to see a list of running processes. find your script and note the process id (pid). then use kill command to kill the script; kill 3432 where 3432 is the pid of the running script. Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622200 Share on other sites More sharing options...
The Little Guy Posted August 21, 2008 Share Posted August 21, 2008 can you shut down your email server? Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622201 Share on other sites More sharing options...
lemmin Posted August 21, 2008 Share Posted August 21, 2008 @ BlueSkyIS: It probably isn't the script that is still running but a gigantic queue that has become laggy. What are you running your mail server with? Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622205 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 could be. but i would expect the output from one script run to come in a block, not "4 to 5 e-mails every 35 to 60 minutes for the last 72 hours" i guess it depends on what the script does and whether there is in fact an infinite loop running. Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622209 Share on other sites More sharing options...
damerit Posted August 21, 2008 Author Share Posted August 21, 2008 I'm not sure what mail server it is. I know that when I get the mail it says "WWW daemon apache". I hope this helps. These are some of my processes.... root 1787 0.0 0.9 8168 2444 ? Ss 11:04 0:00 sshd: root@notty root 1790 0.0 0.5 4632 1300 ? Ss 11:04 0:00 /usr/lib/ssh/sftp-server mysql 1795 0.0 6.7 44248 17284 ? S 11:04 0:03 /usr/sbin/mysqld --basedir=/ --da root 2023 0.0 0.9 8384 2436 ? Rs 11:23 0:00 sshd: root@pts/0 root 2026 0.0 0.7 4088 1824 pts/0 Ss 11:23 0:00 -bash postfix 2172 0.0 0.6 5104 1536 ? S 12:17 0:00 pickup -l -t fifo -u root 2347 0.0 0.3 2720 828 pts/0 R+ 13:32 0:00 ps -aux Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622264 Share on other sites More sharing options...
BlueSkyIS Posted August 21, 2008 Share Posted August 21, 2008 to find a specific running script, use this command: ps -ax | grep scriptname where scriptname is at least part of the name of the script. if it's not listed there, it may be a full email queue. Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622275 Share on other sites More sharing options...
damerit Posted August 21, 2008 Author Share Posted August 21, 2008 I have removed the script 2 days ago and I'm still getting the e-mails. I just don't know how to stop the e-mail queue or service that is causing the e-mails to keep generating. What I think happened is that when I added the code to the script file to generate an e-mail on every record that is > 30 days, the email queue has several emails stored up sending to my company's exchange and the exchange server is only allowing 4 or 5 at a time through. I just don't know why I am still getting them. I thought it would run its course but for 3 days and several thousand emails at increments of 4 or 5 every 30 minutes is stummping me. I can't seem to stop them. This is a backup company server and I hate to restart it just for the email. There has to be a queue or something stored up. Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622319 Share on other sites More sharing options...
mbeals Posted August 21, 2008 Share Posted August 21, 2008 if the script is in a loop, deleting the original file won't do anything, as it is running from memory. do: ps -aux |grep php or ps -aux |grep "nameofscript" and see if it brings anything up. Look at the emails you are getting too. Is the 'sent time' in the header the same for all of them? If it is, or it's very similar, then chances are the que is full. If the sent time keeps up with the receive time, then i'd guess the script is running. If this script was initiated through apache (IE a web interface), then chances are it is not still running, as it would have timed out by now Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622349 Share on other sites More sharing options...
damerit Posted August 21, 2008 Author Share Posted August 21, 2008 I tried to kill the process and it gives me the "No such process". I'm just going to bite the bullet and restart the server. I hate to but I'm stuck. Is there any advice from here.... thanks by the way srv07:/ # ps aux|grep index.php root 2924 0.0 0.2 1828 616 pts/0 S+ 16:54 0:00 grep index.php srv07:/ # kill -9 2924 -bash: kill: (2924) - No such process srv07:/ # Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622406 Share on other sites More sharing options...
kenrbnsn Posted August 21, 2008 Share Posted August 21, 2008 If the email messages are queued up already, restarting the server won't help. You have to delete all of the pending messages from the queue. Ken Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622422 Share on other sites More sharing options...
mbeals Posted August 22, 2008 Share Posted August 22, 2008 I tried to kill the process and it gives me the "No such process". I'm just going to bite the bullet and restart the server. I hate to but I'm stuck. Is there any advice from here.... thanks by the way srv07:/ # ps aux|grep index.php root 2924 0.0 0.2 1828 616 pts/0 S+ 16:54 0:00 grep index.php srv07:/ # kill -9 2924 -bash: kill: (2924) - No such process srv07:/ # if the script was run through apache (opened in a web browser) it would have timed out already...meaning it's not in an infinite loop. srv07:/ # ps aux|grep index.php root 2924 0.0 0.2 1828 616 pts/0 S+ 16:54 0:00 grep index.php is showing you that process 2924 is "grep index.php" not "index.php". It's the PID of the grep command you just issued, not the script actually running. Also, as far as I know, when a script is executed via the apache module, it doesn't show up as a separate process (unless it forks, and even then I'm not sure it would). So in short... the chances of the script still running are slim to none. Quote Link to comment https://forums.phpfreaks.com/topic/120737-solved-mail-stop-auto-send-infinite-loop/#findComment-622914 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.