auto_start.sh and auto_update.shsudo apt-get update && sudo apt-get upgrade -y
It's essential to keep your machine up to date before installing/configuring any new stuff.
sudo apt-get install tmux
auto_start.sh script first - open terminal, make sure, that you are in your home folder (looks like this in terminal: ~) and type:
sudo nano auto_start.sh
Next an empty window of a terminal text editor should pop up. In that window type the following script:
#!/bin/bash
tmux new-session -d -n MINER
tmux send-keys -t MINER "cd /your/path/to/miner/folder" C-m
tmux send-keys -t MINER "sudo ./name_of_your_miner.sh" C-m
tmux send-keys -t MINER "your_password" C-m
It should look like this:
When you're done press ctrl + O then enter and then ctrl + X to save and exit the text editor.
The second script is auto_update.sh - in you terminal type:
sudo nano auto_update.sh
You will be welcomed by the same terminal text editor as the last time. This time type this script:
#!/bin/bash
tmux new-session -t updater
tmux send-keys -t updater "sudo apt autoremove --purge -y" C-m
tmux send-keys -t updater "your_password" C-m
tmux send-keys -t updater "sudo apt-get update && sudo apt-get upgrade -y" C-m
tmux send-keys -t updater "tmux kill-window" C-m
It should like this:
Again: ctrl + O, enter and ctrl + X to save and exit the text editor.
If you open your home folder you should find there your two scritps:
sudo chmod +x auto_start.sh && sudo chmod +x auto_update.sh
then: ./auto_start.sh 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: tmux attach (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:
To terminate the mininig process in your system open a separate terminal window and type:
tmux kill-window -t MINER
this gives tmux a command to terminate the particular tmux window called "MINER" (or whatever your one is gonna be called like):
To make these scripts run automatically on system boot, you gotta put them into the crontab. To do that type crontabe -e 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:
@reboot /path/to/your/auto_start_script
@reboot /path/to/your/auto_update_script
Then traditionally hit ctrl + O, enter and ctrl + X 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:
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: tmux attach 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