Skip to content

Instantly share code, notes, and snippets.

@Suzhou65
Last active September 21, 2020 09:15
Show Gist options
  • Select an option

  • Save Suzhou65/68c982a56e09c20ce005d380d32f631e to your computer and use it in GitHub Desktop.

Select an option

Save Suzhou65/68c982a56e09c20ce005d380d32f631e to your computer and use it in GitHub Desktop.
Raspberry Pi Automatically Report
import re
import os
import sys
import subprocess
from subprocess import PIPE
from subprocess import Popen

p1 = Popen(["ps", "-x"], stdout=PIPE)
p2 = Popen(["grep", "HentaiAtHome"], stdin=p1.stdout, stdout=PIPE)
p1.stdout.close()

psawk = ['awk","NR==1{print$3,$5}"]
         p3 = subprocess.Popen(psawk, stdin=p2.stdout, stdout=subprocess.PIPE)
         p2.stdout.close()
         p4 = p3.communicate()[0];
         output = p4.replace('R','S').replace('l','').replace(+,'').replace(' ','').replace('-','').replace('\n','').decode("utf-8")
         p3.stdout.close()
         
def hathstats():
         state = output
    return (state)

match = re.search(r'Sjava',output)
         if match:
            print"found"
         else:
            print"not found"
pi@raspberrypi:~/python $ python test.py
found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment