I’m sure everyone has had the experience of a server process that was created by some developer and continues to run indefinitely without ending. This script comes in handy in such situations. When you schedule it to run regularly with tools like crontab, it will terminate these seemingly never-ending processes for you. It’s similar to scripts like Terminating Excessive Apache (httpd) Child Processes and Listing Process Execution Directories.
Continue reading Shell: Terminating Long-Running ProcessesTag Archives: script
shell: set up crontab programmatically
I’ll introduce how to set up crontab programmatically with shell script.
Continue reading shell: set up crontab programmaticallypython script for confirmation of sending email
Here is the script of python for confirm sending email, which was used when I was establishing mail server on Amazon AWS EC2, on python 2.7.9.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import smtplib from email.MIMEText import MIMEText from email.Utils import formatdate from_addr = 'sender@sender.com' to_addr = 'your_address@you.com' msg = MIMEText("test") msg['Subject'] = 'subject' msg['From'] = from_addr msg['To'] = to_addr msg['Date'] = formatdate() s = smtplib.SMTP() # Set server and port. Localhost and port 25 are set as default. # s.connect([host[, port]]) s.connect() # Login if the server restrict user of sending mail # s.login('user_name', 'password') s.sendmail(from_addr, [to_addr], msg.as_string()) s.close() |