linux - 无法在 debian 8 中使用服务命令 (Jessie)

标签 linux bash service debian

为了将 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 service tomcat8 start 在那之后起作用了,但 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

关于linux - 无法在 debian 8 中使用服务命令 (Jessie),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30345399/

相关文章:

linux - 检查目录(符号链接(symbolic link))是否仍指向同一位置

angular - NgIf 在变量更改时不更新

linux - 在 Linux 上创建新的以太网 USB 网络接口(interface)

linux - 使用另一个运行 Ansible 的 Vagrant Linux VM 来配置 Vagrant Linux VM

c - Linux/C : Writing command-line arguments to a text file as separate lines?

model-view-controller - 没有呈现 View 的 Spring MVC 请求

tomcat - 命令 "sudo service tomcat start"显示失败但一切正常

linux - 如何更改页表条目以在 linux 中引发页面错误?

linux - 'sudo find/var/www/html -type d -exec chmod g+s {}\;' 中的 {} 和\是什么意思

bash - 如何枚举文件列表