Steem Admin Tools / Smooth Server Reboot Script

in #admin4 years ago


Description


Some Steem node maintainers may already have encountered problems when rebooting their dedicated servers (for example, after installing security updates) without stopping the running steemd instance(s) beforehand.

Just running reboot in the terminal will in many cases corrupt the database, which leads to a necessary full blockchain replay afterwards. This may not be the case when running the node as a service, because the system then waits for the process to gracefully shutdown, but otherwise one should be cautious about using the reboot command.

Yesterday, while I was preparing one of my servers that is running a full node for the coming SDS environment, I needed to reboot the system and I forgot to stop the main steemd process. As described, the database got corrupted and the following logs appeared:

Luckily, I created a backup of the blockchain folder a few hours before, which helped me to get things running again without much waiting time. I advice you to regularly create backups! Trust me, you don't want to wait for a week to replay the whole blockchain again ;)

I thought about how to solve the reboot issue once for all and I created a bash script that enables us to make a smooth reboot just by executing it with root privileges.

Bash Script


#!/bin/bash
proc_name="steemd"

function checkProcesses()
{
    proc_ids=($(pidof "$proc_name"))
    proc_count=${#proc_ids[@]}
}

checkProcesses
for (( i=0; i<$proc_count; i++ )); do
    echo "Found process with id: ${proc_ids[$i]}. Sending SIGINT..."
    kill -SIGINT ${proc_ids[$i]}
done

while [ $proc_count -gt 0 ]
do
    echo "$proc_count process(es) still running. Waiting for close..."
    sleep 3
    checkProcesses
done

echo "No processes found. Rebooting system..."
reboot

The script checks for running steemd processes, sends a SIGINT signal to each process found and waits for their finish, before starting the actual reboot command.

Just store the script in a file smooth_reboot.sh on your server, add execution rights with chmod +x smooth_reboot.sh and you are good to go.

The script can also be downloaded directly here:
steemworld.org/dl/smooth_reboot.sh

I hope this helps Steem witnesses and node providers in general to be able to reboot their system more smoothly from now on.

Terminal Output


Steem On!


If you like what I do and you want me to be your Steem witness,
please vote for @steemchiller on steemit.com/~witnesses or steemworld.org/witnesses.


Sort:  

Servus Steemchiller,

erstmal großes Lob und vielen Dank für den neuen (?) Steem Account Watch, ein weiteres sehr mächtiges Tool! Nun muss ich aber folgende Fehler dazu melden:

  • Bei Filterung nach "Account" funktionieren keine Operatoren und somit dieser Filter überhaupt nicht. Ich wollte den Account eines Freundes, dessen Schreibweise wir nicht genau wissen und der mit "u" anfängt suchen. Das geht aber nicht, da ich da auch mit 1.000 Treffern nicht mal in die Nähe komme bei Sortierung nach Account.
  • Ein Nullwert ("= 0") wird nicht angenommen als Filterkriterium. Es kommen dann alle Werte. Mit z. B. "<= 0.001" geht es.

Der Account hat sehr unspezifische Daten, da er wie viele andere nur angelegt wurde und sonst nichts. Gerade fiel mir ein, dass eine Eingrenzung nach "Created" ginge. Es geht auch mit doppelter Verwendung, also erst mit ">=" und dann mit "<=", aber die richtige Eingabesyntax ist leider nicht erkennbar.

Ich habe es gerade mit den angelsächsischen Schreibweisen "mm/dd/yyyy" und "yyyy/mm/dd" versucht, aber da fängt er gar nicht erst an zu suchen. Der Button löst zwar aus, springt aber nach einem Sekundenbruchteil wieder zurück, ohne dass sich was tut. Auch eine Fehlermeldung kommt nicht.

Danke fürs Testen! Ja, die Datumseingabe ist noch nicht genauer erklärt und ich werde da wahrscheinlich noch ein paar 'Datepicker' hinzufügen. Du könntest mal das Format wie angezeigt (2020-10-13, 16:29:18) probieren oder den numerischen Unix-Timestamp (z.B. von https://www.epochconverter.com).

Ich habe übrigens gerade eben die *chen-Suche hinzugefügt:
steem*, *steem, *steem* und *teem*iller sollten jetzt auch funktionieren ;)

Filterung nach '0' werde ich nachher mal prüfen.

Im wondering... Is Steemit being attacked right now?
1000s of ridiculous usernames are being made every minuteand they are sending phishing links to everyone. Like this....
Screenshot_2020-10-04-11-30-13.png

And like this

Screenshot_2020-10-04-11-45-52.png

What do we do?

Thanks for the info. I will report it to our spam fighters ;)

Thank you.

Hi @steemchiller. I write you from Caracas- Venezuela.

Today I thought that my account was being hacked because while I was seeing part of the @ steemworld.org interface, at the top of the screen on my mobile phone from where I manage my account, it threw a message in red that said "se You have deactivated 98% of your SP. If you did not do this, act now! " The message made me nervous, which is why I immediately thought of transferring my 19 SBD balance to prevent them from being stolen. The entry into the wallet was not possible with the posting or active password. I tried with the owner key and that is how I had access to the wallet, managing to transfer my available liquidity. However, I think it appropriate to leave a record of what happened.

Then I went back into the wallet to check the SP status but it is active.

I appreciate what happened in favor of the safety of the users is considered.

Hi @gabriale, the message should only appear in case you (or someone else) started a Powerdown process for your account. I've checked your recent account operations and I could not find anything related to a Powerdown.

Did you open the SteemWorld site directly via https://steemworld.org/@gabriale or did you use the 'Switch Account' button?

The values in the Balances tab also show that there is no active Powerdown happening in your account:

The entry into the wallet was not possible with the posting or active password.

This is not normal and transfers should always be possible with the active key. Did you use the Steemit wallet (steemitwallet.com)?

Hello @steemchiller I hope you are doing well. Thanks for your answer and vote.
Regarding your questions, I entered steemworld by clicking on the publication link of @ yohan2on. I entered the interface and once I was in the "view account" option, the previously mentioned warning appeared, which led me to reride the 19 SBD that I had accumulated as my brain test earnings. I entered the purse item and on a couple of occasions, it did not take me an active password or posts. It was then that I tried the owner key (suggested by the system in the box where the password is typed) and so I got access to the wallet to make the transfer to a kryptomoneda account. In any case, it seems my account is ok.
Greetings!! And thanks again.

Very useful! Thanks!

Hab dir eine Memo geschickt.

Moin, ich habe gerade nicht wirklich Zeit für solche Späße :) Was ich jetzt schon sagen kann, ist, dass ich die SteemWorld mit den kommenden Funktionen nicht mal eben für andere Chains laufen lassen kann/möchte.

Aktuell habe ich drei dedizierte Server allein für SW gebucht und zwei von denen sind recht kräftige Maschinen, was natürlich zusätzlich zu laufenden, monatlichen Kosten führt.

Meiner Meinung nach kann nichts Besseres/Erfolgreicheres als Steem entstehen, solange dieselben Kern-APIs verwendet werden. Man müsste ganz von vorne anfangen und mit dem jetzigen Wissen alle benötigten APIs sinnvoll voneinander trennen, Daten besser komprimiert speichern und 'Traffic-sparender' an die Clients zurückgeben.

Hab's schon vermutet. Danke!

It's great to see the developments continue coming to the SteemWorld and the Steem blockchain in general thanks to your great work!! Good vibes are feeling in here since a good time, it took a lot of strength but worth it!!

I want to thank you for all the great support in all these times and most important with the Knitrias Project. You may know but I wanted to tell you that the project close its cycle for now, many factors long to tell about them, but the important is the project achieved great things and much of its goals. Thanks to the people supporting us it becomes impulse for the Members' growth and new projects on the way! Surely with time things will organize better here on my side, and Knitrias will be active again with some initiative!!

The funds on the account are being distributed between the Members and the supporters, next week will be the last power down to distribute among supporters as you. It's not too much, but it's important to close the cycle and express my gratitude!!

Thanks for all the great experience, and here I'm looking forward for all what's to come here on Steem!!

All the best for your projects, qSteemChiller, and good wishes for you and yours!!

Thank you @leveuf. You worked very hard for your project and I hope that you will find the time and energy to continue it in future. In my opinion you should take the funds for yourself, because, as far as I know, you really have spent much time for the project and you should be rewarded for that. Please feel free to use my part for improving your life.

All the best to you and your family ;)

Thank you very much for the great encouragement!! I've learned a lot, and will never forget the great experience.

Time will come for new projects. The funds will be to powered up on @Knitrias, as some say: Invest in the future!! :)

A big hug and only the best winds!!

Your post is manually rewarded by the
World of Xpilar Community Curation Trail

join the World of Xpilar Curation Trail, info can be found here

Thank you @steemchiller for that hint. I can imagine how it is when you found yourself in such situation, many of users without IT background would probably even do not think about such things until it happens.

I am very grateful for you being behind the blockchain, you give a feeling of safety and we know that you are always in reach when someone needs help. Cheers...

Thank you @stef1. I knew that the day would come when I will build a solution for the reboot problem. As it also goes for the real life, in most cases it's better to handle foreseeable problems directly.

In this case I waited too long and therefore it hit me, but I'm glad that with my script it can't happen again from now on :)

How are you, my hero, I have made you a supervisor of a society that was established. Tell me about your opinion on that. I consider you to be among the ancients here and you have a distinguished place in my heart. Greetings, all respect and appreciation

https://steemit.com/trending/hive-183209

Very excellent
welcome to my page

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 61110.96
ETH 2649.39
USDT 1.00
SBD 2.58