Last active
August 29, 2015 14:11
-
-
Save jonnung/50015b6c697cd1406678 to your computer and use it in GitHub Desktop.
python으로 좀비 프로세스 만들기
This file contains 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
# -*- 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) |
This file contains 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
# -*- 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