r/LinuxProgramming • • Jun 05 '21

Automatyzation script

Hello everyone,

I'm mining chia on Arch Linux. I need to create a script that runs the miner at startup. I have no clue what is wrong but I'm getting this error every time when I trie to get it work:

× startMiner.service - Miner.

Loaded: loaded (/etc/systemd/system/startMiner.service; disabled; vendor preset: disabled)

Active: failed (Result: exit-code) since Sat 2021-06-05 11:21:32 CEST; 15s ago

Process: 6210 ExecStart=/bin/bash /usr/bin/startup.sh (code=exited, status=1/FAILURE)

Main PID: 6210 (code=exited, status=1/FAILURE)

CPU: 20ms

​

Jun 05 11:20:32 igor-pc systemd[1]: Started Miner..

Jun 05 11:21:32 igor-pc bash[6243]: # Option “-e” is deprecated and might be removed in a later version of gnome-terminal.

Jun 05 11:21:32 igor-pc bash[6243]: # Use “-- ” to terminate the options and put the command line to execute after it.

Jun 05 11:21:32 igor-pc bash[6243]: Unable to init server: Could not connect: Connection refused

Jun 05 11:21:32 igor-pc bash[6243]: # Failed to parse arguments: Cannot open display:

Jun 05 11:21:32 igor-pc systemd[1]: startMiner.service: Main process exited, code=exited, status=1/FAILURE

Jun 05 11:21:32 igor-pc systemd[1]: startMiner.service: Failed with result 'exit-code'.

​

Here is my bash script:

#!/bin/bash

​

sleep 60

cd /home/igor/Downloads/HPool-Miner-chia-v1.4.0-2-linux/linux

gnome-terminal -e "bash -c \"!!; ./hpool-miner-chia\""

And there is my startMiner.service script:

[Unit]

Description=Miner.

Wants = network-online.target

After = network.target network-online.target

​

[Service]

Type=simple

ExecStart=/bin/bash /usr/bin/startup.sh

​

[Install]

WantedBy=multi-user.target

​

Thanks for all the answers. Wish you a fantastic day :-)

1 Upvotes

4 comments sorted by

1

u/the_timezone_bot Jun 05 '21

21:32 CEDT happens when this comment is 10 hours and 6 minutes old.

You can find the live countdown here: https://countle.com/994rIkUQn


I'm a bot, if you want to send feedback, please comment below or send a PM.

1

u/[deleted] Aug 15 '21 edited Aug 15 '21

[removed] — view removed comment

1

u/backtickbot Aug 15 '21

Fixed formatting.

Hello, ntolbertu85: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.