Как запустить scrapyd под своим именем пользователя? - PullRequest
0 голосов
/ 04 мая 2020

Я хочу запустить scrapyd со своим пользователем под Ubuntu 18.04. Поэтому я создал нового пользователя "scrapyd" и пытаюсь его запустить. Это приводит к ошибке:

merlin@spider1:~$ sudo -u scrapyd scrapyd 
2020-05-04T19:46:03+0200 [-] Loading /usr/local/lib/python3.8/dist-packages/scrapyd/txapp.py...
2020-05-04T19:46:03+0200 [-] Scrapyd web console available at http://127.0.0.1:6800/
2020-05-04T19:46:03+0200 [-] Loaded.
2020-05-04T19:46:03+0200 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 20.3.0 (/usr/bin/python3 3.8.2) starting up.
2020-05-04T19:46:03+0200 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2020-05-04T19:46:03+0200 [-] Failed to unlink PID file:
    Traceback (most recent call last):
      File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/twistd.py", line 25, in runApp
        runner.run()
      File "/usr/local/lib/python3.8/dist-packages/twisted/application/app.py", line 385, in run
        self.postApplication()
      File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/_twistd_unix.py", line 261, in postApplication
        self.removePID(self.config['pidfile'])
      File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/_twistd_unix.py", line 288, in removePID
        log.err(e, "Failed to unlink PID file:")
    --- <exception caught here> ---
      File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/_twistd_unix.py", line 283, in removePID
        os.unlink(pidfile)
    builtins.FileNotFoundError: [Errno 2] No such file or directory: '/home/merlin/twistd.pid'

2020-05-04T19:46:03+0200 [stderr#error] Traceback (most recent call last):
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/bin/scrapyd", line 11, in <module>
2020-05-04T19:46:03+0200 [stderr#error]     sys.exit(main())
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/lib/python3.8/dist-packages/scrapyd/scripts/scrapyd_run.py", line 11, in main
2020-05-04T19:46:03+0200 [stderr#error]     run()
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/twistd.py", line 31, in run
2020-05-04T19:46:03+0200 [stderr#error]     app.run(runApp, ServerOptions)
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/lib/python3.8/dist-packages/twisted/application/app.py", line 674, in run
2020-05-04T19:46:03+0200 [stderr#error]     runApp(config)
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/twistd.py", line 25, in runApp
2020-05-04T19:46:03+0200 [stderr#error]     runner.run()
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/lib/python3.8/dist-packages/twisted/application/app.py", line 385, in run
2020-05-04T19:46:03+0200 [stderr#error]     self.postApplication()
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/_twistd_unix.py", line 254, in postApplication
2020-05-04T19:46:03+0200 [stderr#error]     self.startApplication(self.application)
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/_twistd_unix.py", line 437, in startApplication
2020-05-04T19:46:03+0200 [stderr#error]     self.setupEnvironment(
2020-05-04T19:46:03+0200 [stderr#error]   File "/usr/local/lib/python3.8/dist-packages/twisted/scripts/_twistd_unix.py", line 330, in setupEnvironment
2020-05-04T19:46:03+0200 [stderr#error]     with open(pidfile, 'wb') as f:
2020-05-04T19:46:03+0200 [stderr#error] PermissionError: [Errno 13] Permission denied: '/home/merlin/twistd.pid'

Merlin - имя пользователя, выдавшего команду. Как я могу запустить scrapyd под своим именем пользователя?

...