#!/bin/bash # Retrieve arguments ipv4=$(ifconfig | grep "inet addr:" | sed '1!d' | cut -d : -f 2 | cut -b -14) domain=$1 port=$2 sync_node=$3 sync_port=$4 salt=$5 pwd=$6 #cpu=$(($7/100)) #cpu=`expr $7 / 100` # Install dependencies: nodejs, npm sudo apt-get -y -qq install nodejs npm nodejs-legacy sudo npm install -g npm # Install uCoin node and pm2 daemon manager git clone https://github.com/ucoin-io/ucoin /tmp/ucoin sudo npm install -g /tmp/ucoin sudo npm install -g pm2 # Check port availability sudo yunohost app checkport $port if [[ ! $? -eq 0 ]]; then exit 1 fi # Open port on firewall sudo yunohost firewall allow TCP $port > /dev/null 2>&1 # Configure and sync uCoin node ucoind config --noupnp --ipv4 $ipv4 --remote4 $ipv4 --remoteh $domain --port $port --remotep $port --salt $salt --passwd $pwd # --cpu $cpu ucoind sync $sync_node $sync_port # Launch uCoin node with pm2 daemon pm2 start /usr/bin/ucoind -- start