加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 无法使用debian 8的服务命令(Jessie)

发布时间:2020-12-14 02:20:34 所属栏目:Linux 来源:网络整理
导读:为了将LibreOffice 4.4安装到我的Debian 8(Jessie)中,我刚从Debian 7.5获得了所有bash脚本,并以相同的方式运行到D8中. 我知道新版本有一些变化,但我不能再像这样使用我的服务了: sudo service libreoffice start 这样做不会启动任何东西,我必须使用以下方式
为了将LibreOffice 4.4安装到我的Debian 8(Jessie)中,我刚从Debian 7.5获得了所有bash脚本,并以相同的方式运行到D8中.

我知道新版本有一些变化,但我不能再像这样使用我的服务了:

sudo service libreoffice start

这样做不会启动任何东西,我必须使用以下方式启动它:

sudo /etc/init.d/libreoffice start

奇怪的是,做的时候(参数不好):

sudo service libreoffice dzedjiodjzedj

…脚本完美执行并显示我捕获的错误

这是我的/etc/init.d/libreoffice文件:

#
# libreoffice     This shell script takes care of starting and stopping the LibreOffice Daemon
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: libreofficedaemon
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Description: Init.d script to run a LibreOffice Daemon
# Short-Description: start and stop LibreOffice Daemon
### END INIT INFO

NAME="LibreOffice Service"
LIBREOFFICE_HOME=/opt/libreoffice4.4
LIBREOFFICE_USER=libreoffice
export LIBREOFFICE_HOME LIBREOFFICE_USER

start() {
        echo -ne "Starting $NAME. n"
        su $LIBREOFFICE_USER -c "$LIBREOFFICE_HOME/start.sh"
}

stop() {
    echo -ne "Stopping $NAME. n"
    su $LIBREOFFICE_USER -c "$LIBREOFFICE_HOME/stop.sh"
}

kill() {
    echo -ne "Force close of $NAME. "
    killall -u $LIBREOFFICE_USER
}

cd $LIBREOFFICE_HOME
case "$1" in
  start|stop)
        $1;;
  restart) stop; start;;
  kill) kill;;
  *)
    echo "Usage: /etc/init.d/libreoffice {start|stop|restart|kill}"
    exit 1
    ;;
esac

exit 0

而我昨天刚刚用tomcat8服务运行那个问题,我刚开始手动服务和sudo服务tomcat8开始工作之后,但没有libreoffice一个..

来自Debian Jessie发行说明:

When you are asked if any file in the /etc/init.d directory,or the /etc/manpath.config file should be replaced by the package maintainer’s version,it’s usually necessary to answer “yes” to ensure system consistency

解决方法

使用systemd,您现在必须使用systemctl:
sudo systemctl start libreoffice

Here’s some more info

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读