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.

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; ./ -t; exec bash'
screen -dm bash -c 'cd MJ12nodeB; ./ -t; exec bash'
screen -dm bash -c 'cd MJ12nodeC; ./ -t; exec bash'
screen -dm bash -c 'cd MJ12nodeD; ./ -t; exec bash'
screen -dm bash -c 'cd MJ12nodeE; ./ -t; exec bash'
screen -dm bash -c 'cd MJ12nodeF; ./ -t; exec bash'
screen -dm bash -c 'cd MJ12nodeG; ./ -t; exec bash'
screen -dm bash -c 'cd MJ12nodeH; ./ -t; exec bash'
screen -dm bash -c 'cd MJ12nodeI; ./ -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/
chmod 744 MJ12nodeB/
chmod 744 MJ12nodeC/
chmod 744 MJ12nodeD/
chmod 744 MJ12nodeE/
chmod 744 MJ12nodeF/
chmod 744 MJ12nodeG/
chmod 744 MJ12nodeH/
chmod 744 MJ12nodeI/

(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; ./ -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