Linux/Python

· Linux/Python
#!/usr/bin/env python import sys, os, time, atexit from signal import SIGTERM class Daemon: """ A generic daemon class. Usage: subclass the Daemon class and override the run() method """ def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): self.stdin = stdin self.stdout = stdout self.stderr = stderr self.pidfile = pidfile def daemonize(self): """ do the UNIX do..
· 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..
· Linux/Python
vscode Python에서 argument가 있는 파일 디버그방법 import argparse if __name__=='__main__': parser = argparse.ArgumentParser() parser.add_argument("--log", help="log filename", default=None) args = parser.parse_args() print(args.log) { // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요. // 기존 특성에 대한 설명을 보려면 가리킵니다. // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요. "version": "0.2.0", "configuration..
· Linux/Python
증상 root에서는 실행가능, 사용자에서는 퍼미션에러 cd /home/사용자명 ; /usr/bin/env /bin/python3 /home/사용자명/.vscode-server/extensions/ms-python.python-2021.10.1365161279/pythonFiles/lib/python/debugpy/launcher 37148 -- /home/사용자명/TestSample/test.py Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/ping3/__init__.py", line 276, in ping sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, so..
· Linux/Python
리소스. 1. PushOver (스마트폰 알림기능) https://pushover.net/ Pushover: Simple Notifications for Android, iOS, and Desktop Powered by Pushover With our Android, iPhone/iPad, and Desktop Browser clients, you can receive unlimited push notifications on all of your devices from dozens of websites, services, and applications that already integrate with Pushover. Just supply your P pushover.net 2. Python을 이용한 r..
zosystem
'Linux/Python' 카테고리의 글 목록