无法在Debian 8(Jessie)中使用service命令

8
为了在Debian 8 (Jessie)中安装LibreOffice 4.4,我只需从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 service tomcat8 start之后就可以工作了,但是对于LibreOffice则不行。
来自Debian Jessie版本说明:
当你被问及是否应该用软件包维护者的版本替换/etc/init.d目录或/etc/manpath.config文件中的任何文件时,通常需要回答“yes”以确保系统的一致性。
1个回答

7

在使用systemd时,您现在必须使用systemctl命令:

sudo systemctl start libreoffice

Here's some more info


1
为什么?问题是如何在Jessie上启动服务,没有更多了。 - engines
由于链接腐败,链接经常会失效,这并非必要但可能会有所帮助。 - Shafik Yaghmour
如果服务脚本变得无用,并且在调用时甚至没有返回错误,我们该如何删除它?! - sorin

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接