Skip to content

Instantly share code, notes, and snippets.

@jonnung
Last active August 29, 2015 14:11
Show Gist options
  • Save jonnung/50015b6c697cd1406678 to your computer and use it in GitHub Desktop.
Save jonnung/50015b6c697cd1406678 to your computer and use it in GitHub Desktop.
python으로 좀비 프로세스 만들기
# -*- coding: utf8 -*-
import os
import time
from subprocess import Popen
print("# Create zombie process (PID: %s)" % os.getpid())
child_process = Popen(['/usr/local/bin/python', 'zombie.py'])
print("# Fork child-process (PID: %s)" % child_process.pid)
while True:
print("## Sleep parent process..")
time.sleep(10)
# -*- coding: utf8 -*-
import sys
import time
print(" > Running alive child-process")
for r in xrange(10):
if r > 0 and r % 2:
print "-",
else:
print "_",
time.sleep(1)
print("\n > End child-Process!")
print(" >> Oops!! I'm zombie....@_@")
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment