You could use screen or a similar tool like tmux or byoblu.
Otherwise use the NOHUP command.
nohup is a POSIX command to ignore the HUP (hangup) signal. The HUP signal is, by convention, the way a terminal warns dependent processes of logout.
Output that would normally go to the terminal goes to a file called nohup.out if it has not already been redirected.
nohup is a low-level utility simply configuring a command to ignore a signal. As seen below, nohup is very far from being a full-featured batch system solving all the problems of running programs asynchronously.
$ nohup abcd &
$ exit
Alternatives:
The screen or tmux command can also detach a process from the current shell. It allows to reattach to the process later on.
e.g. the following call will run somescript.sh detached from SIGHUP and in the background:
$ screen -A -m -d -S somename ./somescript.sh &
https://en.wikipedia.org/wiki/Nohup
My advice is to learn to use screen (or tmux) so you can later re-attach the process to the main shell and interact with it.
bitcoind -daemon? Otherwise, what version of bitcoind are you using, and what do you see in debug.log? – Nate Eldredge – 2013-11-12T13:34:50.567the last line of debug.log. addcon thread interrupt opencon thread interrupt msghand thread interrupt dumpaddr thread stop Flush(false) DBFlush(false) ended 0ms StopNode() net thread interrupt ERROR: CAddrman::Write() : open failed Flushed 11563 addresses to peers.dat 37ms – André – 2013-11-12T13:46:36.127
1I tried to run with bitcoind -daemon but onde I exit the SSH session the bitcoind stops – André – 2013-11-12T13:47:19.927
@André how do you know it stops? – Loourr – 2013-11-12T14:14:24.137
@Loour, when I telnet the host on 8332 not answer anymore. If I enter again the shell is not running anymore. I've also discovered that when I run "bitcoind -daemon &" the process goes to the pid(example) 12994, but one minute later the pid is on 12995. For this reason when I close the SSH this pid go away. Any clues? – André – 2013-11-12T14:29:12.977
@André Maybe try rebuilding the packages? I really don't know though. Just doing
bitcoind -daemonhas always worked for me. It might also be something with the computer. Does it exit out of other shell scripts when you disconnect? – Loourr – 2013-11-12T15:10:58.840