Author Topic: Problems with BitSharesX daemon initscripting  (Read 2701 times)

0 Members and 1 Guest are viewing this topic.

Offline FuLl

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Got it to work- had to change from Debian to Ubuntu, no problems now.

Seed node is up:
54.165.9.208

Offline FuLl

  • Full Member
  • ***
  • Posts: 101
    • View Profile
It won't even start if I use crontab to start it 120 seconds after reboot, I don't get it.

I'll just have to start it manually.

Offline FuLl

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Screen -dm starts the client when I run the script manually, but it won't start at boot, even after I do:
Code: [Select]
$sudo update-rc.d btsx defaults
But it won't start at boot.

What are other people's init scripts looking like that work?

Are there 'Required Start' parameters I need to add?

This is my script:

Code: [Select]
#!/bin/sh
# Starts bitsharesx
#

### BEGIN INIT INFO
# Provides:             bitshares_client
# Required-Start:       $syslog
# Required-Stop:
# Should-Start:
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    bitshares_client
### END INIT INFO

case "$1" in
start)
        echo ""
        echo "Starting BitSharesX"
        echo ""
sleep 5
        screen -dm bitshares_client --daemon
sleep 10
        $0 view

;;

view)
        ps -e | grep bitshares_client
;;


*)
        echo "Usage: $0 {start}"
        exit 1
esac

Offline FuLl

  • Full Member
  • ***
  • Posts: 101
    • View Profile
This is my initscript:
Code: [Select]
#!/bin/sh
# Starts and stops bitsharesx
#


case "$1" in
start)
        echo ""
        echo "Starting BitSharesX"
        echo ""
        bitshares_client --daemon
sleep 15 &
        $0 view

;;

stop)
   echo ""
   echo "Stoping BitSharesX"

   /usr/bin/bitshares_client exit
sleep 30 &
;;

restart)
     $0 stop
     sleep 30
     $0 start
;;

view)
        ps -e | grep bitshares_client
;;


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


Offline Riverhead

Does your start script have a loop in it? like while true start client?

Also, you can launch the client via screen then you'll always be able to get back to a command prompt with <cntrl-a> <d>

Offline FuLl

  • Full Member
  • ***
  • Posts: 101
    • View Profile
I don't know if stop is an actual command though, it was an example cause that's how other clients work, like bitcoin and its many clones.

Check the possible options with --help.

I'm using the stop/exit commands as per the documentation here:
https://github.com/BitShares/bitshares_toolkit/wiki/Bitshares-commands:-General

--help doesn't mention how to exit it.

Offline svk

I don't know if stop is an actual command though, it was an example cause that's how other clients work, like bitcoin and its many clones.

Check the possible options with --help.

To kill it find the process ID with "ps a" then do "kill -9 PID"
Worker: dev.bitsharesblocks

Offline FuLl

  • Full Member
  • ***
  • Posts: 101
    • View Profile
I tried adding the & after a sleep period so it wouldn't place output after I got my prompt back, & that got me my command prompt back, but now it won't stop.

When I do:
Code: [Select]
$sudo bitshares_client stopI get this:
Code: [Select]
$ sudo bitshares_client stop
Loading blockchain from: /root/.BitSharesX/chain
Loading config from file: /root/.BitSharesX/config.json
------------ error --------------
10001 db_in_use_exception: Database in Use
Unable to open database /root/.BitSharesX/peers.leveldb
        IO error: lock /root/.BitSharesX/peers.leveldb/LOCK: Resource temporarily unavailable
    {"db":"/root/.BitSharesX/peers.leveldb","msg":"IO error: lock /root/.BitSharesX/peers.leveldb/LOCK: Resource temporarily unavailable"}
    p2p  level_pod_map.hpp:58 open

    {}
    p2p  level_pod_map.hpp:62 open
$
I can't even kill it with 'sudo htop' or 'sudo pkill bitshares_client'...

It appears to be starting when I tell it to stop, doesn't it.

Any ideas?

-Thanks

Offline svk

Maybe you need to add an & at the end? Never used the daemon myself so not sure. To stop the daemon you probably need to do something like "bithshares_client stop", don't think CTRL+c will suffice.

To regain control of your terminal do CTRL+z then type bg.
Worker: dev.bitsharesblocks

Offline FuLl

  • Full Member
  • ***
  • Posts: 101
    • View Profile
BitsharesX is the GUI, you need to start "bitshares_client --daemon".

Thanks, that did it, but now I have a new problem.

I start it from a script in etc/init.d, & when I start it, it displays the following output, but doesn't release my console back to a bash prompt.

Code: [Select]
Starting BitSharesX

Loading blockchain from: /root/.BitSharesX/chain
Loading config from file: /root/.BitSharesX/config.json
Initializing genesis state from built-in genesis file
Please be patient, this will take a few minutes...
Successfully re-indexed 0 blocks in 0 seconds.
Starting JSON RPC server on port 43021 (localhost only)
Starting HTTP JSON RPC server on port 38631 (localhost only)
Running in daemon mode, ignoring console

Is there a way to get my prompt back after I start it?

Plus, once I <Ctrl-C> to exit that, if I do:
Code: [Select]
$bitshares_client exitI get the following output, with a prompt I have to type 'quit' at to exit completely.
Code: [Select]
$ bitshares_client exit
Loading blockchain from: /home/admin/.BitSharesX/chain
Loading config from file: /home/admin/.BitSharesX/config.json
Initializing genesis state from built-in genesis file
Please be patient, this will take a few minutes...
Successfully re-indexed 0 blocks in 0 seconds.
Starting JSON RPC server on port 56544 (localhost only)
Starting HTTP JSON RPC server on port 46261 (localhost only)
Attempting to map P2P port 1776 with UPNP...
Listening for P2P connections on port 1776
Adding peer 80.240.133.79:1776 to peer database
Adding peer 104.131.35.149:1776 to peer database
Adding peer 178.62.50.61:1776 to peer database
Adding peer 178.62.157.161:1776 to peer database
Adding peer 178.62.50.61:1779 to peer database
Adding peer 180.153.142.120:1777 to peer database
Adding peer 188.226.195.137:60696 to peer database
Adding peer 5.101.106.138:1777 to peer database
Adding peer 80.240.133.79:1778 to peer database
Adding peer 95.85.33.16:8764 to peer database
Adding peer 61.129.33.213:1776 to peer database
Adding peer 84.238.140.192:42577 to peer database
Adding peer 54.77.51.177:1776 to peer database
Adding peer 5.101.106.138:1778 to peer database
Adding peer 5.101.106.138:1776 to peer database
Adding peer 178.62.50.61:1777 to peer database
Adding peer 80.240.133.79:1777 to peer database
Adding peer 54.79.27.224:1776 to peer database
Adding peer 178.62.50.61:1778 to peer database
Adding peer 89.187.144.203:8764 to peer database
--- there are now 1 active connections to the p2p network
--- syncing with p2p network, 550807 blocks left to fetch
--- there are now 2 active connections to the p2p network
--- there are now 3 active connections to the p2p network
--- there are now 4 active connections to the p2p network
--- there are now 5 active connections to the p2p network
--- there are now 6 active connections to the p2p network
--- there are now 7 active connections to the p2p network
--- there are now 8 active connections to the p2p network
--- there are now 9 active connections to the p2p network
--- there are now 10 active connections to the p2p network
--- there are now 11 active connections to the p2p network
--- there are now 12 active connections to the p2p network
--- there are now 13 active connections to the p2p network
--- there are now 14 active connections to the p2p network
--- there are now 15 active connections to the p2p network
(wallet closed) >>>

How do I exit fully & get a command prompt back?
« Last Edit: September 22, 2014, 08:49:29 am by FuLl »

Offline svk

BitsharesX is the GUI, you need to start "bitshares_client --daemon".

Not sure how to launch the daemon on Windows though if that's what you're trying to do.
Worker: dev.bitsharesblocks

Offline FuLl

  • Full Member
  • ***
  • Posts: 101
    • View Profile
Hi,

When I try to start the client in daemon mode using:
Code: [Select]
$BitSharesX --daemonI get the following error:
Code: [Select]
QXcbConnection: Could not connect to display
Aborted

Of course it happens without the --daemon flag as well, but I expect that as XOrg isn't installed.

OS is Debian Wheezy, client is installed via Ubuntu ppa, using Debian Sid dependencies.

How do I get past this?

Please advise.

Thanks,
-F
« Last Edit: September 22, 2014, 08:51:50 am by FuLl »