AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 744348
Accepted
Izzno
Izzno
Asked: 2016-03-11 08:33:33 +0800 CST2016-03-11 08:33:33 +0800 CST 2016-03-11 08:33:33 +0800 CST

活动:活动(退出)服务 plexconnect 开始退出

  • 772

我已经安装了一个名为“plexconnect”的 python 脚本,它基本上是一个脚本,用来欺骗我的 Apple tv3 在别处寻找它的预告片。来源:https ://github.com/iBaa/PlexConnect

然后我做了一个初始化脚本。来源:https ://forums.plex.tv/discussion/156534/install-on-ubuntu-server

我对这个守护进程的(小)问题是在重新启动后服务总是以活动状态(退出)启动:

● plexconnect.service - LSB: This is the Plex Connect daemon
   Loaded: loaded (/etc/init.d/plexconnect; bad; vendor preset: enabled)
   Active: active (exited) since sø. 2016-03-27 14:29:27 CEST; 1min 14s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1043 ExecStart=/etc/init.d/plexconnect start (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 512)


mars 27 14:29:26 lenox2 systemd[1]: Starting LSB: This is the Plex Connect daemon...
mars 27 14:29:27 lenox2 plexconnect[1043]:  * Starting the process PlexConnect
mars 27 14:29:27 lenox2 systemd[1]: Started LSB: This is the Plex Connect daemon.

在我重新启动服务后,它可以正常工作(运行):

● plexconnect.service - LSB: This is the Plex Connect daemon
   Loaded: loaded (/etc/init.d/plexconnect; bad; vendor preset: enabled)
   Active: active (running) since sø. 2016-03-27 14:31:09 CEST; 1s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1911 ExecStop=/etc/init.d/plexconnect stop (code=exited, status=0/SUCCESS)
  Process: 1921 ExecStart=/etc/init.d/plexconnect start (code=exited, status=0/SUCCESS)
    Tasks: 6 (limit: 512)
   CGroup: /system.slice/plexconnect.service
           ├─1930 /usr/bin/SCREEN -S PlexConnect -d -m /usr/local/lib/PlexConnect/PlexConnect.py
           ├─1933 python /usr/local/lib/PlexConnect/PlexConnect.py
           ├─1936 python /usr/local/lib/PlexConnect/PlexConnect.py
           ├─1940 python /usr/local/lib/PlexConnect/PlexConnect.py
           ├─1942 python /usr/local/lib/PlexConnect/PlexConnect.py
           └─1944 python /usr/local/lib/PlexConnect/PlexConnect.py


mars 27 14:31:09 lenox2 systemd[1]: Starting LSB: This is the Plex Connect daemon...
mars 27 14:31:09 lenox2 plexconnect[1921]:  * Starting the process PlexConnect
mars 27 14:31:09 lenox2 systemd[1]: Started LSB: This is the Plex Connect daemon.

我试图停止 plexmediaserver 并重新启动 plexconnect 以检查是否存在依赖关系问题,但如果没有 plexmediaserver 它运行良好。我还尝试将 plexmediaserver 作为Required-Start 添加到初始化脚本中:

#Required-Start:  networking plexmediaserver

然后:

sudo update-rc.d plexconnect defaults
insserv: Service plexmediaserver has to be enabled to start service plexconnect
insserv: exiting now!

很明显我在这里需要帮助。我现在唯一的线索是重启后底部服务状态的额外 python 行。可能是python需要成为必需的开始吗?

初始化脚本的完整代码:

#!/bin/bash
### BEGIN INIT INFO
# Provides:          plexconnect
# Required-Start:    networking
# Required-Stop:     networking
# Default-Start:     3 4 5
# Default-Stop:      0 1 6
# Short-Description: This is the Plex Connect daemon
# Description:       This script starts the Plex Connect
#                    Python scripts in a detached screen.
### END INIT INFO

# Using the lsb functions to perform the operations.
./lib/lsb/init-functions

# Process name ( For display )
NAME=PlexConnect

# Daemon name, where is the actual executable
DAEMON="/usr/bin/screen"
DAEMON_OPTS="-S PlexConnect -d -m /usr/local/lib/PlexConnect/PlexConnect.py"
DAEMON_USER="root"

# pid file for the daemon
PIDFILE=/var/run/PlexConnect.pid

# If the daemon is not there, then exit.
test -x "$DAEMON"||exit5

case $1 in
 start)
  # Checked the PID file exists and check the actual status of process
  if[-e $PIDFILE ];then
   status_of_proc -p $PIDFILE "$DAEMON $DAEMON_OPTS""$NAME process"&& status="0"|| status="$?"
   # If the status is SUCCESS then don't need to start again.
   if[ $?="0"];then
    log_success_msg "Starting the process $NAME"
    exit# Exit
   fi
  fi
  # Start the daemon.
  # Start the daemon with the help of start-stop-daemon
  # Log the message appropriately
  if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -p $PIDFILE -- ${DAEMON_OPTS};then
   while read line ;do[[ $line =~([0-9]*).PlexConnect]]&& echo ${BASH_REMATCH[1]};done<<(screen -ls)> $PIDFILE
   log_success_msg "Starting the process $NAME"
  else
   log_failure_msg "Starting the process $NAME"
  fi
  ;;
 stop)

  # Stop the daemon.
  if[-e $PIDFILE ];then
   status_of_proc -p $PIDFILE "$DAEMON DAEMON_OPTS""Stoppping the $NAME process"&& status="0"|| status="$?"
   if["$?"=0];then
    start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
    /bin/rm -rf $PIDFILE
    log_success_msg ""Stopping the $NAME process""
   fi
  else
   log_failure_msg "$NAME process is not running"
  fi
  ;;
 restart)
  # Restart the daemon.
  $0 stop && sleep 2&& $0 start
  ;;
 status)
  # Check the status of the process.
  if[-e $PIDFILE ];then
   status_of_proc -p $PIDFILE "$DAEMON $DAEMON_OPTS""$NAME process"&&exit0||exit $?
   log_success_msg "$NAME process is running"
  else
   log_failure_msg "$NAME process is not running"
  fi
  ;;
 reload)
  $0 restart
  ;;
 *)
  # For invalid arguments, print the usage message.
  echo "Usage: $0 {start|stop|restart|reload|status}"
  exit2
  ;;
esac

编辑:

我一直在考虑将 sysvinit (plexconnect) 转换为 Upstart.conf,因为 plexconnect 是 Upstart.conf,但后来我发现 ubuntu 现在使用 systemd。

我现在遇到的问题是,由于某种原因,plexmediaserver 作为 Upstart 运行,当我尝试创建 Upstart plexconnect.conf 时,会发生这种情况:

initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

所以现在我更加困惑了……如果 16.04 不允许我更新 Upstart,plexmediaplayer 怎么会成为 Upstart 服务?(通过 Ubuntu 软件包安装)。

15.10
  • 1 1 个回答
  • 2553 Views

1 个回答

  • Voted
  1. Best Answer
    Izzno
    2017-02-06T10:21:10+08:002017-02-06T10:21:10+08:00

    主要问题是 Plexmediaserver 正在使用 Upstart/systemD,因此 init 脚本失败。

    我制作的本指南中的更多信息:http ://forums.plex.tv/discussion/213637/ubuntu-15-debian-8-raspbian-jessie-arch-or-based-autostart

    • 0

相关问题

  • Ubuntu 15.10 MD5 校验和在哪里?

  • 如何在 freedesktop 服务中使用刷新命令?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve