Last active
August 4, 2016 10:16
-
-
Save Drunkar/7886415 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import commands | |
import sendGmail | |
from datetime import datetime | |
from datetime import timedelta | |
arg = "" | |
while len(arg) == 0: | |
arg = raw_input("input substring of process name: ") | |
INTERVAL = timedelta(seconds=5) | |
from_addr = "<FROM_ADDR>@gmail.com" | |
passwd = "<PASS>" | |
to_addr = "<TO_ADDR>@gmail.com" | |
title = arg + " end." | |
body = "" | |
previous = datetime.now() | |
while True: | |
if datetime.now() - previous > INTERVAL: | |
result = commands.getoutput("ps ax | grep " + arg + " | grep -v grep") | |
previous = datetime.now() | |
if arg not in result: | |
msg = sendGmail.create_message(from_addr, to_addr, title, body) | |
sendGmail.send_via_gmail(from_addr, to_addr, passwd, msg) | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment