1

I'm running tinkerOS which is a distribution of debian. But for some reason the cwhservice that works on raspbian (also debian based) doesn't run on tinkerOS.

The script is placed in /etc/init.d/ and is called cwhservice, systemctl deamon-reload has been done and the code is as follows :

#!/bin/sh
### BEGIN INIT INFO
# Provides:          CWH
# Required-Start: $all
# Required-Stop:
# Default-Start:        2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the CWH
# Description: Starts the CWH
### END INIT INFO

case "$1" in
        start)
/opt/cwh/start.sh > /opt/cwh/log.scrout 2> /opt/cwh/log.screrr
;;
        stop)
/opt/cwh/stop.sh
;;
        restart)
/opt/cwh/stop.sh
/opt/cwh/start.sh
;;
*)
  echo "Usage: $0 {start|stop|restart}"
esac
exit 0

when I run : sudo service cwhservice start I get the following error :

Job for cwhservice.service failed because the control process exited with error code.
See "systemctl status cwhservice.service" and "journalctl -xe" for details.

systemctl status cwhservice.service gives :

● cwhservice.service - LSB: Starts the CWH
   Loaded: loaded (/etc/init.d/cwhservice; generated; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2017-08-24 13:36:22 UTC; 1min 21s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 15431 ExecStart=/etc/init.d/cwhservice start (code=exited, status=203/EXEC)

Aug 24 13:36:22 linaro-alip systemd[1]: Failed to start LSB: Starts the CWH.
Aug 24 13:36:22 linaro-alip systemd[1]: cwhservice.service: Failed with result 'exit-code'.

So after fiddling with all code and values I still didn't got it too work so I tried to remodel the reboot script which ended up currently as :

#! /bin/sh
### BEGIN INIT INFO
# Provides:          kaas2
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:      6
# Short-Description: Execute the reboot command.
# Description:
### END INIT INFO

case "$1" in
  start)
        # No-op
        /opt/cwh/start.sh
        echo "foo" >&2
        ;;
restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
  stop)
        ;;
  status)
        exit 0
        ;;
  *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac

sudo service cwhservice start doesn't return an error but just does nothing. But for some strange reason sudo service cwhservicer restart actually starts the start.sh script but doesn't return the echo... So I'm totally lost at this point and wasted 2 days...

Any ideas on how to create a deamon which I can start on boot and starts the start.sh script on debian?

kloknibor
  • 55
  • 1
  • 7
  • Have you installed `lsb-release` on tinkerOS? – dlmeetei Aug 24 '17 at 13:49
  • I just checked and it was already pre-installed – kloknibor Aug 24 '17 at 13:50
  • Also the tinkerboard version is 1.9 and the start.sh command runs fine if run from the terminal. – kloknibor Aug 24 '17 at 14:00
  • I know I might be too late, but it could be useful if anyone finds this later. I had similar issue I was troubleshooting for some time. When you start an init.d script manually (using "start" option) and then terminate via alternative means (by not using "stop" option) systemctl still report service as active. In my case this meant that each subequent "start" command didn't actually run the script again as service was still running. Running a "stop" and then "start" or "restart" command will result in script rinning again. – Alex May 15 '19 at 13:31

0 Answers0