Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # A menu driven shell script sample template
- ## ----------------------------------
- # Step #1: Define variables
- # ----------------------------------
- EDITOR=vim
- PASSWD=/etc/passwd
- RED='\033[0;41;30m'
- STD='\033[0;0;39m'
- # ----------------------------------
- # Step #2: User defined function
- # ----------------------------------
- pause(){
- read -p "Press [Enter] key to continue..." fackEnterKey
- }
- one(){
- #echo "one() called"
- sudo reboot
- }
- two(){
- #echo "two() called"
- sudo pkill miner && sudo /home/ubuntu/cpuminer-multi/minerd -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u candrarisky1922@gmail.com -p x -t 1
- }
- three(){
- #fix mdadm.conf no array
- sudo echo "ARRAY <ignore> devices=/dev/sda" >> /etc/mdadm/mdadm.conf
- sudo update-initramfs -u
- sudo apt-get update
- }
- four(){
- sudo echo "/home/ubuntu/cpuminer-multi/minerd -a cryptonight -o stratum+tcp://xmr.pool.minergate.com:45560 -u candrarisky1922@gmail.com -p x -t 1" > /etc/init.d/zminer.sh
- sudo chmod +x /etc/init.d/zminer.sh
- sudo chmod ugo+x /etc/init.d/zminer.sh
- sudo update-rc.d zminer.sh defaults
- }
- # function to display menus
- show_menus() {
- clear
- echo "~~~~~~~~~~~~~~~~~~~~~"
- echo " M A I N - M E N U"
- echo "~~~~~~~~~~~~~~~~~~~~~"
- echo "1. Reboot"
- echo "2. Start Miner"
- echo "3. Fix mdadm.conf No Array"
- echo "4. Install Miner Every Boot"
- echo "5. Exit"
- }
- # read input from the keyboard and take a action
- # invoke the one() when the user select 1 from the menu option.
- # invoke the two() when the user select 2 from the menu option.
- # Exit when user the user select 3 form the menu option.
- read_options(){
- local choice
- read -p "Choose Options" choice
- case $choice in
- 1) one ;;
- 2) two ;;
- 3) three ;;
- 4) four ;;
- 5) exit 0;;
- *) echo -e "${RED}Error...${STD}" && sleep 1
- esac
- }
- # ----------------------------------------------
- # Step #3: Trap CTRL+C, CTRL+Z and quit singles
- # ----------------------------------------------
- trap '' SIGINT SIGQUIT SIGTSTP
- # -----------------------------------
- # Step #4: Main logic - infinite loop
- # ------------------------------------
- while true
- do
- show_menus
- read_options
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement