Skip to content


Linux bash script to update and start multiple MJ12node crawlers

This post is more of a note to myself. First here is the script, and explanations follow. For a first-time installation, refer to How to install MJ12node on Ubuntu 18.04.

wget https://example.com/mj12node_linux_v1721_net471.tgz
tar xf mj12node_linux_v1721_net471.tgz
cp -r MJ12node/* MJ12nodeA
cp -r MJ12node/* MJ12nodeB
cp -r MJ12node/* MJ12nodeC
cp -r MJ12node/* MJ12nodeD
cp -r MJ12node/* MJ12nodeE
cp -r MJ12node/* MJ12nodeF
cp -r MJ12node/* MJ12nodeG
cp -r MJ12node/* MJ12nodeH
cp -r MJ12node/* MJ12nodeI
screen -dm bash -c 'cd MJ12nodeA; ./run.py -t; exec bash'
screen -dm bash -c 'cd MJ12nodeB; ./run.py -t; exec bash'
screen -dm bash -c 'cd MJ12nodeC; ./run.py -t; exec bash'
screen -dm bash -c 'cd MJ12nodeD; ./run.py -t; exec bash'
screen -dm bash -c 'cd MJ12nodeE; ./run.py -t; exec bash'
screen -dm bash -c 'cd MJ12nodeF; ./run.py -t; exec bash'
screen -dm bash -c 'cd MJ12nodeG; ./run.py -t; exec bash'
screen -dm bash -c 'cd MJ12nodeH; ./run.py -t; exec bash'
screen -dm bash -c 'cd MJ12nodeI; ./run.py -t; exec bash'

The first line downloads the file containing the new version (obviously, adapt with the proper URL).
Then we unpack it: its contents all goes into a “MJ12node” folder (again, adapt with the proper name).

Then we copy the contents of that new MJ12node folder into existing nodes. By default, cp should just overwrite without asking for confirmation. If not, you may want to look into this guide.

Finally, we launch each node in a dedicated and detached screen session. For this, this screen reference was pretty helpful as well as this StackExchange answer (wasn’t picked as the best answer, as it often happens with real best answers – meh).

Update (2021-11-23)

Since I recently had to set everything up again, some additions for 1st-time installation:

mkdir MJ12nodeA
mkdir MJ12nodeB
mkdir MJ12nodeC
mkdir MJ12nodeD
mkdir MJ12nodeE
mkdir MJ12nodeF
mkdir MJ12nodeG
mkdir MJ12nodeH
mkdir MJ12nodeI
chmod 744 MJ12nodeA/run.py
chmod 744 MJ12nodeB/run.py
chmod 744 MJ12nodeC/run.py
chmod 744 MJ12nodeD/run.py
chmod 744 MJ12nodeE/run.py
chmod 744 MJ12nodeF/run.py
chmod 744 MJ12nodeG/run.py
chmod 744 MJ12nodeH/run.py
chmod 744 MJ12nodeI/run.py

(to mix it up with the commands listed higher, it’s first mkdir then cp then chmod then screen)

Additionally, I found a slightly more comfortable way to run in screen: the original version said things like screen -dm bash -c 'cd MJ12nodeH; ./run.py -t; exec sh', but replacing sh with bash gives more features.

Also, here’s an updated list of dependencies for Ubuntu 21.10:
sudo apt-get install python mono-runtime libmono-sqlite4.0-cil bind9
It appears that libmono-corlib4.5-cil is no longer necessary and that Python isn’t installed by default now.
Bind isn’t strictly mandatory, but if you don’t have it or an equivalent, you’ll get a much higher DNS error rate.

Lastly, a tip to speed up configuring your nodes: you can just start and configure one node, then copy the config file to other (non running) nodes. You then just need to change the node name in the config file (config.xml => PeerNodeCfg => NodeName), and you’re all good to go.

Posted in servers, software.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

Sorry about the CAPTCHA that requires JS. If you really don't want to enable JS and still want to comment, you can send me your comment via e-mail and I'll post it for you.

Please solve the CAPTCHA below in order to fight spamWordPress CAPTCHA