B
B
BushaevDenis2018-06-29 14:58:30
SUSE
BushaevDenis, 2018-06-29 14:58:30

How to make a script for init.d?

The second day I suffer in an attempt to kill chrome before rebooting / shutting down normally, so that it does not lose the tabs.
What I did: created a file /usr/local/sbin/killchrome (chmod +x of course) with the content:

#!/bin/bash

killall chrome

sleep 5

The script is normally run by handles and kills chrome, so that when you open it, all the tabs are in place.
Then I created a killchrome file in /etc/init.d/ with the following content:
#!/bin/sh

### BEGIN INIT INFO
# Provides:          newkillchrome
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     0 6
# Default-Stop:      
# Short-Description: Kill all chrome proccesses 
placed in /etc/init.d
### END INIT INFO

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi
KIND="newkillchrome"
start() {
        echo -n $"Starting $KIND services: "
        sh /usr/local/sbin/killchrome
}	

stop() {
}	

restart() {
}	

case "$1" in
  start)
          start
        ;;
  stop)
          stop
        ;;
  restart)
          restart
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac
exit $?

and started the service via YaST
But after restart/shutdown chrome still needs to restore the tabs.
(I tried to just throw the script from /usr/local/sbin/ directly to /etc/init.d/rc6,d/ didn't work either)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question