PID

· Windows
// process가 이미 종료되었는지 확인후 process가 살아 있을경우 CloseMainWindows,kill작업 시작 // 실행한 프로세스 정상종료(CloseMainWindow())를 하고난뒤에도 process가 살아 있을경우 // 강제 kill public void KillProcess(int pid) { try { ManagementObjectSearcher procSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_Process WHERE ParentProcessID=" + pid); if (procSearcher.Get().Count > 0) { Process proc = Process.GetProcessById(pid); proc...
· Linux/Python
# https://stackoverflow.com/questions/48506824/automatic-start-and-stop-of-apscheduler-during-boot-of-linux import signal import atexit import os import time PID_FILE_PATH = "pythonPID.pid" stop = False def create_pid_file(): # this creates a file called program.pid with open(PID_FILE_PATH, "w") as fhandler: # and stores the PID in it fhandler.write(str(os.getpid())) def sigint_handler(signum, f..
zosystem
'PID' 태그의 글 목록