create account

TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux by lifipp

View this thread on: hive.blogpeakd.comecency.com
· @lifipp · (edited)
$134.68
TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux
<h3>So you have configured your Linux mining rig and it works flawlessly, but you do not want to check on it every day or maybe you are going on vacation and you have to leave your lovely mining rig at home for two weeks... alone... :O How to make sure that everything is going to work even without your support? It's unbelievably easy and straight forward - you just gotta write two simple scritps called <code>auto_start.sh </code> and <code>auto_update.sh</code></h3>

![cover.jpg](https://steemitimages.com/DQmSayd8Qbi1VczyxdALNwn1p8PvXsMy8SZNRerauametYR/cover.jpg)

<h2>Step 0:</h2>
First things first, before you start doing ANYTHING with your Linux system - always run:

**<code>sudo apt-get update && sudo apt-get upgrade -y</code>**

It's essential to keep your machine up to date before installing/configuring any new stuff.

<h2> Step 1:</h2>
Install tmux (that's a special thing for running multiple terminal windows/sessions and to be able to send keys keys in particular terminal window - it's gonna come in handy for our scripts):

**<code>sudo apt-get install tmux</code>**

<h2>Step 2:</h2>
Now things are gonna get a lil bit more complicated - you are going to write those two scripts... :O
Let's start with our **<code>auto_start.sh</code>** script first - open terminal, make sure, that you are in your **<code>home</code>** folder (looks like this in terminal: ~) and type:

**<code>sudo nano auto_start.sh</code>**

![3.jpg](https://steemitimages.com/DQmVyhRxed6rGxC89HKc5zeJc4kro2CVU2zk3s6oHwoprSR/3.jpg)

Next an empty window of a terminal text editor should pop up. In that window type the following script:

<b>`#!/bin/bash`</b>

<b>`tmux new-session -d -n MINER`</b>
<b>`tmux send-keys -t MINER "cd /your/path/to/miner/folder" C-m`</b>
<b>`tmux send-keys -t MINER "sudo ./name_of_your_miner.sh" C-m`</b>
<b>`tmux send-keys -t MINER "your_password" C-m`</b>

<h6>*Where "your/path/to/miner/folder" represents the path to your miner folder, "your_password" your system password and "name_of_your_miner.sh" the name of the your miner's running script (obviously...). If you have other miner than EWBF"s CUDA or you are mining on AMD cards the starting script might have a different name so double check that! And btw. - you can name your session as you want - I named mine: MINER</h6>

It should look like this:

![4.jpg](https://steemitimages.com/DQmWkBEA9wcWoBCsWZbDDWvK4XUMWyokZXMo7asyBAiMuH9/4.jpg)

When you're done press **<code>ctrl + O</code>** then **<code>enter</code>** and then **<code>ctrl + X</code>** to save and exit the text editor.

The second  script is **<code>auto_update.sh</code>** - in you terminal type:



**<code>sudo nano auto_update.sh</code>**

![5.jpg](https://steemitimages.com/DQmSY3ijJBkPRc2oVKpin299toxieGoyYehiKyEVUsU8QpZ/5.jpg)

You will be welcomed by the same terminal text editor as the last time. This time type this script:

<b>`#!/bin/bash`</b>

<b>`tmux new-session -t updater`</b>
<b>`tmux send-keys -t updater "sudo apt autoremove --purge -y" C-m`</b>
<b>`tmux send-keys -t updater "your_password" C-m`</b>
<b>`tmux send-keys -t updater "sudo apt-get update && sudo apt-get upgrade -y" C-m`</b>
<b>`tmux send-keys -t updater "tmux kill-window" C-m`</b>

<h6>*Again - where "your_password" should be YOUR password :D and the session does not have to be called "updater" it can be called "nexus of the wisdom" if you would like to.</h6>

It should like this:

![6.jpg](https://steemitimages.com/DQmdew1WSWi4gVHw3XqWaQPjb2DJ9hC1WevHCLs6G1gR87y/6.jpg)

Again: **<code>ctrl + O</code>**, **<code>enter</code>** and **<code>ctrl + X</code>** to save and exit the text editor.

If you open your <b>`home`</b> folder you should find there your two scritps:

![7.jpg](https://steemitimages.com/DQmZiUjThzajCsBH2nJR2d7d23EFAosDKFBqTNCDCWpDosa/7.jpg)

<h2> Step 3:</h2>
In order to run and test them type in your terminal:

<b>`sudo chmod +x auto_start.sh && sudo chmod +x auto_update.sh`</b>

then: <b>`./auto_start.sh`</b> to run your. Nothing should happen - in order to see the mining process, you have to open the special tmux window that we've created in our script. Type: <b>`tmux attach`</b> (either in the same terminal or in new terminal window). If you have followed all the steps and typed everything right, you should see a terminal window pop up with your miner running:

![9.jpg](https://steemitimages.com/DQmdemED4wM2FbvPUy2Tw5Yg7jZNzVNS2WjL8J26utqKLVK/9.jpg)

![10.jpg](https://steemitimages.com/DQmdakpB74sR7E492DL7rc8wUffBxya8cJNmuq9Fc1Ct7WF/10.jpg)

To terminate the mininig process in your system open a separate terminal window and type:

<b>`tmux kill-window -t MINER`</b>

![15.jpg](https://steemitimages.com/DQmcW9joRTEsarWeiJFQqZEXG1qFi2B958eGNB7shggJgcr/15.jpg)

this gives tmux a command to terminate the particular tmux window called "MINER" (or whatever your one is gonna be called like):

![16.jpg](https://steemitimages.com/DQmSgh1ZC25wzXoj2xS3rC5tBjKp6CL89vghFRhB6Q4K6qM/16.jpg)

<h2>Step 4:</h2>

To make these scripts run automatically on system boot, you gotta put them into the <b>`crontab`</b>. To do that type <b>`crontabe -e`</b> in your terminal window. You will be welcomed by a window full of text describing what crontab does and how to use it. Scroll to the bottom and there type:

<b>`@reboot /path/to/your/auto_start_script`</b>
<b>`@reboot /path/to/your/auto_update_script`</b>

<h5> *I really do not have to explain what does that code after "@reboot" do, do I? :)</h5>

![13.jpg](https://steemitimages.com/DQmQ6mVgMRjUqSVeP9aaNs22dKvrzkav2utX6AJp5yT8Wdp/13.jpg)

Then traditionally hit **<code>ctrl + O</code>**, **<code>enter</code>** and **<code>ctrl + X</code>** to save and exit the text editor. If there are no errors in your crontab command you should see the terminal writing that the new crontab is being installed:

![14.jpg](https://steemitimages.com/DQmbiMTPG8a5a63zArmdyqjF2xjpy559VVL5ivXYDn8fs8Z/14.jpg)

And that's it - you are done! I strongly recommend you to turn off your password on log in and also turn off sleep mode in settings menu so that the system does not encounter any problems to run automatically by itself. To test the whole thing out reboot your system. Then open your terminal window and type: <b>`tmux attach`</b> if you see the miner running you've done everything right and now can care much less about your miner, because from now on it's fully automated! :)

Please let me know in the comments below if everything went well, if you have any questions do not hesitate to ask - I would love to answer them. Upvote, resteem and follow me for more tutorials!

Also check out my other tutorial on how to set up and configure mining rig running on Linux: https://steemit.com/cryptocurrency/@lifipp/tutorial-or-how-to-set-up-and-configure-your-mining-rig-on-linux-nvidia-cards

---

<a><i><b>-lifipp a.k.a Hash Courier
post #009</b></i></a>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorlifipp
permlinktutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux
categorymining
json_metadata{"tags":["mining","cryptocurrency","tutorial","linux","ubuntu"],"image":["https://steemitimages.com/DQmSayd8Qbi1VczyxdALNwn1p8PvXsMy8SZNRerauametYR/cover.jpg","https://steemitimages.com/DQmVyhRxed6rGxC89HKc5zeJc4kro2CVU2zk3s6oHwoprSR/3.jpg","https://steemitimages.com/DQmWkBEA9wcWoBCsWZbDDWvK4XUMWyokZXMo7asyBAiMuH9/4.jpg","https://steemitimages.com/DQmSY3ijJBkPRc2oVKpin299toxieGoyYehiKyEVUsU8QpZ/5.jpg","https://steemitimages.com/DQmdew1WSWi4gVHw3XqWaQPjb2DJ9hC1WevHCLs6G1gR87y/6.jpg","https://steemitimages.com/DQmZiUjThzajCsBH2nJR2d7d23EFAosDKFBqTNCDCWpDosa/7.jpg","https://steemitimages.com/DQmdemED4wM2FbvPUy2Tw5Yg7jZNzVNS2WjL8J26utqKLVK/9.jpg","https://steemitimages.com/DQmdakpB74sR7E492DL7rc8wUffBxya8cJNmuq9Fc1Ct7WF/10.jpg","https://steemitimages.com/DQmcW9joRTEsarWeiJFQqZEXG1qFi2B958eGNB7shggJgcr/15.jpg","https://steemitimages.com/DQmSgh1ZC25wzXoj2xS3rC5tBjKp6CL89vghFRhB6Q4K6qM/16.jpg","https://steemitimages.com/DQmQ6mVgMRjUqSVeP9aaNs22dKvrzkav2utX6AJp5yT8Wdp/13.jpg","https://steemitimages.com/DQmbiMTPG8a5a63zArmdyqjF2xjpy559VVL5ivXYDn8fs8Z/14.jpg"],"app":"steemit/0.1","format":"markdown","links":["https://steemit.com/cryptocurrency/@lifipp/tutorial-or-how-to-set-up-and-configure-your-mining-rig-on-linux-nvidia-cards"]}
created2017-07-20 10:54:33
last_update2017-07-22 09:36:12
depth0
children10
last_payout2017-07-27 10:54:33
cashout_time1969-12-31 23:59:59
total_payout_value101.393 HBD
curator_payout_value33.285 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6,880
author_reputation1,017,272,269,062
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id9,064,230
net_rshares32,375,425,752,593
author_curate_reward""
vote details (31)
@admiralmutiny ·
Thank you for the excellent guide.  This worked great for me.  I did need to add the path to cudartlib in the environment file instead of where I had it just in the shrc file, but most people probably already had that set up properly.  Another tip is to use "control-b" then "d" to detach from the tmux viewer.  I find it nice to ssh into the system and use tmux attach to view the miner activity, then just detach and exit so I don't kill the session and have to start it over.
👍  
properties (23)
authoradmiralmutiny
permlinkre-lifipp-tutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux-20180220t024236033z
categorymining
json_metadata{"tags":["mining"],"app":"steemit/0.1"}
created2018-02-20 02:42:42
last_update2018-02-20 02:42:42
depth1
children0
last_payout2018-02-27 02:42:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length478
author_reputation9,601,621
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id38,945,232
net_rshares614,503,785
author_curate_reward""
vote details (1)
@heriafriadiaka ·
I am not know about that... but good share... @lifipp
properties (22)
authorheriafriadiaka
permlinkre-lifipp-2017721t873256z
categorymining
json_metadata{"tags":"cryptocurrency","app":"esteem/1.4.6","format":"markdown+html","community":"esteem"}
created2017-07-21 01:07:36
last_update2017-07-21 01:07:36
depth1
children1
last_payout2017-07-28 01:07:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length53
author_reputation417,485,017,711
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries
0.
accountesteemapp
weight500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id9,138,495
net_rshares0
@lifipp ·
Thank you @heriafriadiaka :)
properties (22)
authorlifipp
permlinkre-heriafriadiaka-re-lifipp-2017721t873256z-20170721t084127457z
categorymining
json_metadata{"tags":["mining"],"users":["heriafriadiaka"],"app":"steemit/0.1"}
created2017-07-21 08:41:27
last_update2017-07-21 08:41:27
depth2
children0
last_payout2017-07-28 08:41:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length28
author_reputation1,017,272,269,062
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id9,171,560
net_rshares0
@jraysteem ·
$0.07
Thank you for sharing this
👍  
properties (23)
authorjraysteem
permlinkre-lifipp-tutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux-20170720t142314100z
categorymining
json_metadata{"tags":["mining"],"app":"steemit/0.1"}
created2017-07-20 14:23:21
last_update2017-07-20 14:23:21
depth1
children1
last_payout2017-07-27 14:23:21
cashout_time1969-12-31 23:59:59
total_payout_value0.056 HBD
curator_payout_value0.017 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length26
author_reputation8,784,912,117,192
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id9,082,700
net_rshares18,331,894,993
author_curate_reward""
vote details (1)
@lifipp ·
You are always welcome @jraysteem :)
properties (22)
authorlifipp
permlinkre-jraysteem-re-lifipp-tutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux-20170720t145813581z
categorymining
json_metadata{"tags":["mining"],"users":["jraysteem"],"app":"steemit/0.1"}
created2017-07-20 14:58:15
last_update2017-07-20 14:58:15
depth2
children0
last_payout2017-07-27 14:58:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length36
author_reputation1,017,272,269,062
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id9,086,395
net_rshares0
@mralan ·
I've followed your easy to understand guide and now my Linux rigs are mining. Thank you so much! :)

<p><center> http://www.FlippyCoin.com is the #1 Cryptocurrency Exchange!<a href="http://www.flippycoin.com"><img src="http://i65.tinypic.com/r2ur9d.jpg"/></a>
<a href="https://www.youtube.com/c/mralanc?sub_confirmation=1"></center></p>
<br>
<img src="https://steemitimages.com/0x0/http://i67.tinypic.com/zxjzt5.png"/></a><a href="https://www.youtube.com/c/mralanc?sub_confirmation=1"><img src="http://i67.tinypic.com/2d6wffo.jpg"/></a><a href="https://twitter.com/alan_craker"><img src="http://i68.tinypic.com/6olafq.png"/></a><a href="http://steemit.com/@mralan"><img src="http://i67.tinypic.com/syl27a.gif"/></a>
👍  
properties (23)
authormralan
permlinkre-lifipp-tutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux-20170720t160453425z
categorymining
json_metadata{"tags":["mining"],"image":["http://i65.tinypic.com/r2ur9d.jpg","https://steemitimages.com/0x0/http://i67.tinypic.com/zxjzt5.png","http://i67.tinypic.com/2d6wffo.jpg","http://i68.tinypic.com/6olafq.png","http://i67.tinypic.com/syl27a.gif"],"links":["http://www.FlippyCoin.com","http://www.flippycoin.com","https://www.youtube.com/c/mralanc?sub_confirmation=1","https://twitter.com/alan_craker","http://steemit.com/@mralan"],"app":"steemit/0.1"}
created2017-07-20 16:04:51
last_update2017-07-20 16:04:51
depth1
children0
last_payout2017-07-27 16:04:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length715
author_reputation-888,240,113,906
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id9,093,349
net_rshares871,071,014
author_curate_reward""
vote details (1)
@romz410 · (edited)
Very useful, helped a ton is an understatement. Tremendous!
properties (22)
authorromz410
permlinkre-lifipp-tutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux-20180609t195442606z
categorymining
json_metadata{"tags":["mining"],"app":"steemit/0.1"}
created2018-06-09 19:54:42
last_update2018-06-09 20:15:18
depth1
children0
last_payout2018-06-16 19:54:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length59
author_reputation10,356,205,797,751
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id60,040,453
net_rshares0
@rudel ·
nice tutorial  keep sharing thanks for this upvoted
👍  
properties (23)
authorrudel
permlinkre-lifipp-tutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux-20170725t092912920z
categorymining
json_metadata{"tags":["mining"],"app":"steemit/0.1"}
created2017-07-24 15:25:24
last_update2017-07-24 15:25:24
depth1
children1
last_payout2017-07-31 15:25:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length51
author_reputation-26,242,897,548
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id9,549,574
net_rshares52,676,679
author_curate_reward""
vote details (1)
@lifipp ·
Glad to help you @rudel :) thanks for upvoting!
properties (22)
authorlifipp
permlinkre-rudel-re-lifipp-tutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux-20170725t003202365z
categorymining
json_metadata{"tags":["mining"],"users":["rudel"],"app":"steemit/0.1"}
created2017-07-25 00:32:03
last_update2017-07-25 00:32:03
depth2
children0
last_payout2017-08-01 00:32:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length47
author_reputation1,017,272,269,062
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id9,602,332
net_rshares0
@trapizomba ·
Very nice tutorial!

Just need some adjustments to run @ Ubuntu/Mint:

# sudo crontab -e (You need to use the cron of root to be able to use @reboot)

The correct syntax of the command should be:

@reboot sleep 30; /path/to/your/auto_start_script

The "sleep 30" is needed to give enough time to let the OS mount the device where is the user script.
properties (22)
authortrapizomba
permlinkre-lifipp-tutorial-or-auto-update-and-auto-start-scripts-for-mining-rigs-running-on-linux-20180111t092719942z
categorymining
json_metadata{"tags":["mining"],"users":["reboot"],"app":"steemit/0.1"}
created2018-01-11 09:27:18
last_update2018-01-11 09:27:18
depth1
children0
last_payout2018-01-18 09:27:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length349
author_reputation0
root_title"TUTORIAL | Auto-update and Auto-start scripts for mining rigs running on Linux"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id28,709,331
net_rshares0