LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2018, 07:57 PM   #1
n3w2l1nux
LQ Newbie
 
Registered: Jan 2018
Posts: 1

Rep: Reputation: Disabled
Smile Help with a simple (for you) script


Hi,

I am pretty new to Linux, because I am now mining crypto's. Running Ubuntu 16.04 LTS.

Would like to create a simple script that will do the following when started from within a terminal:

cd /usr/local/claymore10.2/
./mine.sh
(run a timer for 12 hours and then...)
Ctrl+C (to cancel the ETH miner)
cd /usr/local/cryptonote10.2/
./start_etn.sh
(run a timer for 12 hours and then...)
Ctrl+C (to cancel the ETN miner)
(and then loop)

At least I think this is the way to approach this. Clearly my goal here is to have my mining rig switch between the ETH miner and the ETN miner every 12 hours without any involvement from me.

I built the rig myself and it's going pretty well, but I don't even know where to start with this next little phase of the project. I could probably spend many hours learning and reading how to do this, but instead here is a chance for someone to show off their Linux-scripting prowess and save me a lot of time!

Thanks in advance for your help!
 
Old 01-05-2018, 09:25 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,082

Rep: Reputation: 1903Reputation: 1903Reputation: 1903Reputation: 1903Reputation: 1903Reputation: 1903Reputation: 1903Reputation: 1903Reputation: 1903Reputation: 1903Reputation: 1903
something like this, you'll have to weed out my test file names and add yours then test it
file name of this script
./try_run.kill.run

Code:
#!/bin/bash

while [ true ] 
do

#/usr/local/claymore10.2/mine.sh &

~/echobash


# Wait x amount of time  ( seconds here) 
sleep 2
 
#KILL IT

pkill -u $USER -o echobash

#(run a timer for 12 hours and then...)

#Ctrl+C (to cancel the ETH miner)
#cd /usr/local/cryptonote10.2/
#./start_etn.sh
##(run a timer for 12 hours and then...)
#Ctrl+C (to cancel the ETN miner)
#(and then loop)


done
test script to run then kill then run then kill ...
Code:
#!/bin/bash

echo " running ...."
results
Code:
userx@solus ~ $ ./try_run.kill.run
 running ....
 running ....
 running ....
 running ....
^C
if you only want the main control script to run x amount of times.
Code:
#!/bin/bash

count=0

while [ $count -lt 5 ] 
do

~/echobash &
  
sleep 2

pkill -u $USER -o echobash
 
# repeat steps for a different script


#keep count
((count+=1))

done
runs five times then quits

Last edited by BW-userx; 01-05-2018 at 09:39 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help getting started simple simple shell script dhonnoll78 Programming 6 12-17-2007 05:34 PM
Simple script to wait for another script Maverick1182 Linux - Newbie 4 11-05-2007 03:45 AM
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
Need help with a simple script shell script WindowBreaker Linux - Software 2 12-15-2005 12:45 PM
Simple C Shell script is not so simple elconde Programming 2 09-16-2001 11:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration