AutoStart Staker Daemon on Boot
This post is a supplement to the previous blog Staking Alt Coins for Passive Income. Have a read of that first, then this one will make sense.
The purpose of this post is to supplement that post to make things run smoother, bringing it closer to the goal of "set it, and forget it".
AutoStart the Staker Service
In Linux linggo, a service (in the Windows world) is synonymous with daemon. So whenever this word appears on this blog, it practically refers to the same thing, in all intents and purposes.
Ubuntu 16.04 LTS, which is the operating system of the VPS runs the systemd building block. Basically that means, it is responsible for controlling, starting, and stopping the services (or daemons) that run.
It can automatically start a service on boot, and restart that service on failure when configured to do so. And that is exactly what we need for the NYEX staker node.
Service Configuration File
First, create the file nyex-staker.service. The contents should be the following lines.
[Unit]
Description=NYEX Staker Service
After=network.target
[Service]
User=nyex
Group=nyex
Type=forking
ExecStart=/usr/local/bin/nyeriumd -daemon
ExecStop=/usr/local/bin/nyerium-cli stop
Restart=always
RestartSec=5
PrivateTmp=True
TimeoutStopSec=60s
TimeoutStartSec=60s
StartLimitInterval=120s
StartLimitBurst=15
[Install]
WantedBy=multi-user.target
On a vim window, it should look like this.
The filename need not be nyex-staker.service. It could be any arbitrary name that ends with the extension .service. I named it that since it makes sense, and it is easily understood.
Load the Service
Next, copy the service to the proper directory for loading to the systemd configuration.
$ sudo cp nyex-staker.service /etc/systemd/system
Then, ask the system to re-read the configuration files.
$ sudo systemctl daemon-reload
Enable the new service.
$ sudo systemctl enable nyex-staker
Run the Staker Service
Putting the service under systemd enables the auto-restart of the service in case of failure. Also it starts the service on boot time, as previously mentioned. So let's put that to use.
If the service is running, stop it first.
$ nyerium-cli stop
Then, start the service under systemd control.
$ sudo systemctl start nyex-staker
Check Staker Service
The last logical thing to do is check if the service is running. There are several ways to do this.
Under systemd
Using systemctl command, you will be able to check and see if the daemon is running.
$ systemctl status nyex-staker
You should be able to see the status of the service. It should indicate either active (running) or exited, if failed. The failure message is indicated as well.
Using nyerium-cli
Using the downloaded nyerium-cli binary, the status of the staker can be checked as well. It follows, that if the wallet is running, then staking is in place.
$ nyerium-cli getinfo
With the above command the line containing "staking status" should reflect "Staking Active". If you just started the service, staking does not immediately occur. The wallet needs to completely sync with the network. In my experience, this should not take more than 10 minutes to start staking.
I have also uploaded the service configuration above in my github repository.
If you like this post, you know what to do.
Support:
- Bitcoin (BTC) - 3Kyjg1Wj1PNGN3KhiRprxYvvQpdjC5kT3k
- Etherium (ETH) - 0x5F168F895C63ccC5FbEf921047bc2b63f6780c3F
- SmartCash - SbgqBUuGBVaaFERmc5zPn8XStxXe7vE1SL
@djimirji up!
💡 @dillagr get upvote on 95% (VotingPower 9659.61).
Post can fall into a two-day rating and get a reward.
Rules for calling bot:
Very interesting all the content and I congratulate you because it is very complete step by step we must continue, greetings.
This post has received a 1.56 % upvote from @drotto thanks to: @dillagr.
How Cool!
You got a 3.70% upvote from @coolbot courtesy of @dillagr!
Help us grow, delegate today!
Congratulations! This post has been upvoted from the communal account, @minnowsupport, by dillagr from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.
If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.
💡 Congratulations, your post was rated Rating of the posts who called djimirji. Period 10.6.2018-12.6.2018.