Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use service command with debian 8 (Jessie)

In order to install LibreOffice 4.4 into my Debian 8 (Jessie), I just got all my bash scripts from my Debian 7.5 and run them into the same way into the D8 one.

I know there was several changes into the new version but I'm not able to use my service like this anymore :

sudo service libreoffice start

When doing this doesn't start anything and I have to start it using :

sudo /etc/init.d/libreoffice start

And strange thing, when doing (bad parameter) :

sudo service libreoffice dzedjiodjzedj

...the script is perfectly executed and it displays my catched error

Here is my /etc/init.d/libreoffice file :

    #
# 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

And I just run that issue with tomcat8 service yesterday, I just started manually the service and sudo service tomcat8 start worked after that but nothing for libreoffice one..

From the Debian Jessie Release Notes :

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

like image 594
eento Avatar asked May 20 '15 09:05

eento


1 Answers

With systemd you now have to use systemctl:

sudo systemctl start libreoffice

Here's some more info

like image 164
engines Avatar answered Oct 01 '22 20:10

engines