electroneum / electroneum-pool

GNU General Public License v2.0
177 stars 172 forks source link

npm update fails if it's from bash script #62

Open MRTN87 opened 6 years ago

MRTN87 commented 6 years ago

So, I created my pool and I am facing some weird problem. My pool was working fine and I decided to create bash files that are going to run electroneumd and node init.js right after my server starts/restarts.

When I am trying to do npm update from npm.sh I am getting this: https://pastebin.com/Ted1DXeB But if I do npm update by myself there are no errors and I can start the pool with no problems.

Here's my npm.sh that's supposed to npm update itself.

#!/bin/bash DATE=$(date +"%Y-%m-%d-%H:%M") cd /root/pool/ . ~/.nvm/nvm.sh nvm use 0.10.25 npm update 2>&1 | tee /root/logs/npm/$DATE.log exit 0

EDIT: Another thing, what is this? https://image.prntscr.com/image/mnHWgeXhSeqE6tt2aP6fnw.png

electroneumRepo commented 6 years ago

Firstly,

It seems that your running the pool as root. This is your first mistake. Under no circumstances should you run the script as root, or any npm commands.

Secondly, that looks like a console.log that I have left in the code when I have been debugging.

I'll get this removed, it's nothing to worry about.

MRTN87 commented 6 years ago

Should I reinstall the pool again with non root user? Or I can only create another user and execute the commands?

electroneumRepo commented 6 years ago

In my opinion, You should start again from scratch on non root user.

Running as root will cause unexpected things to happen.

MRTN87 commented 6 years ago

I figured that one out! Now I am facing other problems. I've been mining on my pool for one day and when I put my payment address it says Pending Payment: 00.00

Also admin.html says Total Owed 0.00 Total Paid 0.00 Total Mined 0.00 Profit (before tx fees) 0.00 Average Luck NaN% Orphan Percent NaN Registered Addresses 1

electroneumRepo commented 6 years ago

@MRTN87 that means you have not yet found a block. If your the only miner it can take a while because of the amount of miners on the whole network. There are at least 15 pools running with plenty of miners. The network hashrate is currently 172MH/s

MRTN87 commented 6 years ago

My pool says that there is no block found in redis? Just to make it clear. For my pool to run as it should I need electroneumd electroneum-wallet-rpc node init.js Is that everything?

electroneumRepo commented 6 years ago

If it is saying no block found then you have not mined a block so there is no reward to give.

Yes those are the 3 things needed

vkupar commented 6 years ago

@electroneumRepo I know how to run electroneumd as background process with --detach command, but how to run electroneum-wallet-rpc as a background process? I can't use "screen" to manage that things. I tryied but when I close terminal, it closes process automatically.

Zer0dn commented 6 years ago

@vatex run it using screen but when you need to detach from it use CTRL+A then CTRL+D and that will detach you securely from the wallet cli.

vkupar commented 6 years ago

@Zer0dn and when I close my ssh client, it won't be canceled? I mean wallet rpc will be running?

Zer0dn commented 6 years ago

@vatex assuming you do the ctrl+a then ctrl+d no it will stay running. When you hit ctrl+d it will disconnect the screen session. You can check that it is still running by issuing the command

screen -ls

It will then list all the screen sessions you have running You can reconnect to them also by running the command

screen -r sessionName

Zer0dn commented 6 years ago

@vatex you should only use the cli wallet to create your wallet files. Once that is done you should use only the RPC side of it which can be started using the following command...Replacing the %% variables with specifics from your setup.

screen -d -m -S walletrpc /home/%sudoUserAccount%/electroneum/build/release/bin/electroneum-wallet-rpc --wallet-file /home/%sudoUserAccount%/electroneum/build/release/bin/%WalletNameToLoad% --password %yourIncrediblyLongWalletPassword% --rpc-bind-ip %bindToIP% --rpc-bind-port %bindToPort% --confirm-external-bind --disable-rpc-login

Then whenever you want to check it you can run the command

screen -r walletrpc

*Note: The confirm external bind is only needed if you HAVE to use an external IP to bind it to. In my case I have a firewalled LAN in which my wallet server has 0 access to or from the world which is why I use it. If you bind to local host you can omit the "--confirm-external-bind" portion. If you use "--confirm-external-bind" make for dead certain you know your server is hardened and offline to the world otherwise its at risk.

vkupar commented 6 years ago

@Zer0dn Thank you