0

Basically what I have to do is run the following command,

./home/pooldaemon/monero-stratum/build/bin/monero-stratum /home/pooldaemon/monero-stratum/config.json

the only disadvantage that this brings with it is that I can't do anything else. So I would like to make it run in the background so that I can do other things on my linux server in the mean time.

For the record I am running Linux Ubuntu 16.04 LTS Server.

I have ran true different solutions but quiet honestly most off them are to far out of my knowledge and understanding off linux.

4
  • What have you tried ? /home/pooldaemon/monero-stratum/build/bin/monero-stratum /home/pooldaemon/monero-stratum/config.json & or better use screen to you can reattach if needed. help.ubuntu.com/community/Screen
    – Panther
    Oct 5 '17 at 16:36
  • tried not really much since I am to affraid to mess things up and having to redo everything from scratch. I have basically been going trough forums looking to answers on similar questions but tbh I don't have much experience in scripts etc.
    – Cedric
    Oct 5 '17 at 16:45
  • 1
    Give it some time, "knowledge and understanding" will improve. Oct 5 '17 at 17:07
  • I think other alternative is to append this line-command to ~/.profile, so this command will be run at session startup. My question is: How many times will ~/.profile be executed in a user session? Because I know ~/.bashrc will be executed whenever we open a terminal.
    – Redbob
    Oct 5 '17 at 17:51
1

If it's ok that your terminal needs to be open, the common way would be to append & to your command (as previously mentioned). But I would not recommend that as you won't be able to use the terminal any more (your command will still promt its output). It's better to forward the output to a file or - if you don't need the output - to "nowhere" by appending > /dev/null > 2>&1 &. The > /dev/null redirects all output to "nowhere", including errors (2>&1) and the last & executes the command in the background.. Try:

./home/pooldaemon/monero-stratum/build/bin/monero-stratum /home/pooldaemon/monero-stratum/config.json > /dev/null 2>&1 &

I think, there is no way to do it any simpler, but using a daemon would be better. Depends on your requirements...

1
  • Thanks this did it for me, just added "> /dev/null 2>&1 &" after my command and id did what I wanted it to do. gotta love Linux and it's community.
    – Cedric
    Oct 5 '17 at 18:19
0

In addition to redirecting the output, you can protect the process from your logout by using "nohup" as in

nuhup ./home/pooldaemon/monero-stratum/build/bin/monero-stratum /home/pooldaemon/monero-stratum/config.json &

The nohup command traps the hangup signal that processes can receive when a parent process terminates.

0

As bodhi.zazin suggested:

./home/pooldaemon/monero-stratum/build/bin/monero-stratum /home/pooldaemon/monero-stratum/config.json &

Another option might be to run it as a daemon process. If using a graphical terminal, this would allow you to close the terminal without aborting the process. You can read a general description of daemon processes on Wikipedia.

Not the answer you're looking for? Browse other questions tagged or ask your own question.