Results 1 to 6 of 6

Thread: Keeping A Program Always Running

  1. #1
    Join Date
    Dec 2012
    Beans
    2

    Keeping A Program Always Running

    I have a server and I connect to it via PuttY.
    The thing is that I use it for LTC mining.
    I use CPUMiner but, when I close the PuttY window [Or Due To Timeout I Get Disconnected], the CPUMiner also closes.
    Is there any way to keep the CPU Miner running?
    Also, can I add my CPUMiner command to startup and if yes how?
    My CPUMiner is stored in /opt/cpuminer-2.3.2

    The CPUMiner initiation command or me is like this ./minerd --url=stratum+tcp://host.comort --userpass=user.workerass

  2. #2
    Join Date
    May 2007
    Location
    Leeds, UK
    Beans
    1,664
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Keeping A Program Always Running

    You can use the nohup command (NO Hang UP) to leave the program running after you disconnect. Appending '&' puts the program into background so that you can type 'exit' to get out of the shell.

    Code:
    nohup ./minerd -url=... &
    http://www.cyberciti.biz/tips/nohup-...ll-prompt.html
    http://www.thegeekstuff.com/2010/05/...ackground-job/

    If you control the server, a longer term solution would be to set the service to create on startup on the server. The steps for doing so would depend on the server.
    Please create new threads for new questions.
    Please wrap code in code tags using the '#' button or enter it in your post like this: [code]...[/code].

  3. #3
    Join Date
    Jul 2013
    Location
    Wisconsin
    Beans
    1,199

    Re: Keeping A Program Always Running

    So you want free, detailed, customized advice to make your money-making more efficient?

    You must learn how to write Upstart jobs in /etc/init, or how to use any of the screen, tmux, byobu, or retty packages.
    Last edited by ian-weisser; December 7th, 2013 at 03:18 PM.

  4. #4
    Join Date
    Sep 2006
    Beans
    7,200
    Distro
    Lubuntu Development Release

    tmux

    If your app keeps shutting down on its own then you'll want to make an upstart job of it.

    If you just want to be able to log in and out and check status and output then you want a terminal multiplexer like screen or tmux. If you haven't used either, then I would recommend using tmux. It's a cleaner rewrite and is less complicated yet just as flexible. tmux is in the repository.

    To use tmux, just run it on the remote machine after you've connected with PuTTY or ssh.

    Code:
    tmux
    Then start your application. You are free then to disconnect or close your window. To come back to the same session, log back into the remote machine and then re-attach to the existing tmux session.

    Code:
    tmux attach
    You'll resume the session in progress.

  5. #5
    Join Date
    Dec 2012
    Beans
    2

    Re: Keeping A Program Always Running

    Quote Originally Posted by r-senior View Post
    You can use the nohup command (NO Hang UP) to leave the program running after you disconnect. Appending '&' puts the program into background so that you can type 'exit' to get out of the shell.

    Code:
    nohup ./minerd -url=... &
    http://www.cyberciti.biz/tips/nohup-...ll-prompt.html
    http://www.thegeekstuff.com/2010/05/...ackground-job/

    If you control the server, a longer term solution would be to set the service to create on startup on the server. The steps for doing so would depend on the server.
    I did it, and I got
    Code:
     nohup: ignoring input and appending output to `nohup.out'
    Is it okay?

  6. #6
    Join Date
    Jan 2010
    Location
    Kolkata India
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Keeping A Program Always Running

    Quote Originally Posted by deepak2001 View Post
    I did it, and I got
    Code:
     nohup: ignoring input and appending output to `nohup.out'
    Is it okay?
    It is okay, the terminal output will be redirected to file nohup.out as it has not been redirected to other file.
    “Progress is made by lazy men looking for easier ways to do things”
    — Robert A. Heinlein

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •