SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы
Список вопросов ПечатьМетки: python
RemiZOffAlex Создано: 2018-02-26 08:30:04.520976 Обновлено: 2018-02-26 08:30:04.520976 |
---|
Файл /etc/rc.d/daemon.py #!/usr/bin/env python3 # -*- coding: UTF-8 -*- __author__ = 'RemiZOffAlex' __copyright__ = '(c) RemiZOffAlex' __license__ = 'MIT' __email__ = 'remizoffalex@mail.ru' __url__ = 'http://remizoffalex.ru' import os import sys import json from subprocess import Popen, PIPE def start(): pass def stop(): pass if __name__ == "__main__": if len(sys.argv) == 2: if 'start' == sys.argv[1]: start() elif 'stop' == sys.argv[1]: stop() elif 'restart' == sys.argv[1]: stop() start() else: print("Unknown command") sys.exit(2) sys.exit(0) else: print("Usage: %s start|stop|restart" % sys.argv[0]) sys.exit(2) Делаем исполнимым chmod +x /etc/rc.d/daemon.py Запускаем /etc/rc.d/daemon.py start |