How to launch an uCoin node as a service

In my /etc/init.d/ucoin_mb file :

#! /bin/sh
# /etc/init.d/ucoin_mb

### BEGIN INIT INFO
# Provides:          scriptname
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

export PATH=$PATH:/usr/local/bin
export NODE_PATH=$NODE_PATH:/usr/local/lib/node_modules

case "$1" in
  start)
  #exec forever --sourceDir=/root/myPrograms/ucoin_metab/ucoin/bin/ucoind -p /var/run/forever start
  exec node --harmony /root/myPrograms/ucoin_metab/ucoin/bin/ucoind start >> /var/log/ucoin_mb.log 2>&1
  ;;

  stop)
  exec forever --sourceDir=/root/myPrograms/ucoin_metab/ucoin/bin/ucoind stop
  ;;
esac

exit 0

>_ update-rc.d ucoin_mb defaults

>_ update-rc.d ucoin_mb enable  

>_ sudo service ucoin_mb start

my sources :
https://www.debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian
https://thomashunter.name/blog/running-a-node-js-process-on-debian-as-an-init-d-service/

It doesn’t work , any help ? :slight_smile:

Isn’t there any error message ?
Does it works when you run it normally ?
Maybe a missing slash or wrong path in
exec node --harmony bin/ucoind start -> exec node --harmony /bin/ucoind start

ah no :o

root@vps209375:~/myPrograms/ucoin_metab/ucoin# node --harmony ./bin/ucoind start

51.254.203.24:8889/node/summary
Nothing :o

Je vais refaire une install je crois : D

$ node --harmony ./bin/ucoind start

Should give you an output, could you give it to us?

Finally I reinstalled ,
node --harmony ./bin/ucoind start
works :slight_smile:

( maybe because I had 2 uCoin installs or maybe an unstopped process )

Still need help for the service : )

J’aime bien le script ;u
c’est simple d’installation / configuration
https://raw.githubusercontent.com/ucoin-io/ucoin/master/install.sh