chipbike (OP)
Newbie
Offline
Activity: 43
Merit: 0
|
|
January 21, 2014, 10:00:03 PM Last edit: January 21, 2014, 10:15:21 PM by chipbike |
|
Hi, I'm setting up a Bitcoind server in a Ubuntu 12.04. I'm trying to understand how can I start Bitcoind at boot and keep it running in the background. For example, if I do: The server will start, but if I close the terminal window, the server will shut down after a while. I've googled some more and found this: https://bitcointalk.org/index.php?topic=25518.msg317426#msg317426I've tried the solution above, but without success. I've done all the steps but the Bitcoind don't even start. There are any strategies to keep the Bitcoind running based on things like Supervidord( http://supervisord.org/)?I accept any clue on how to put Bitcoind starting at boot. Thanks,
|
|
|
|
Abdussamad
Legendary
Offline
Activity: 3682
Merit: 1580
|
|
January 22, 2014, 08:43:29 PM |
|
Have you tried changing $cmd to: cmd="$home/bin/bitcoind -daemon"
|
|
|
|
rubensayshi
Newbie
Offline
Activity: 30
Merit: 0
|
|
July 17, 2014, 10:34:28 AM |
|
you could you supervisord for this with a config along the lines of: [program:bitcoind] command=bitcoind -datadir=/home/bitcoin/.bitcoin -daemon=0 user=bitcoin group=bitcoin process_name=%(program_name)s stdout_logfile=/var/log/bitcoind.log redirect_stderr=true stdout_logfile_maxbytes=5MB stdout_logfile_backups=5 stdout_capture_maxbytes=5MB stopasgroup=true autostart=true autorestart=true startretries=10 startsecs=10 stopwaitsecs=10
the user/group are set to use bitcoin/bitcoin and the -datadir is specified to use "/home/bitcoin/.bitcoin", if you're okay with running everything as root then remove the user/group line and change the datadir to "/root/.bitcoin" the command includes the -datadir because the $HOME env var isn't set when supervisord starts when your server (re)starts. the command must include "-daemon=0" because otherwise the process will spawn the daemon with a different PID and then exit and supervisord will see that as a crash! the other options are just copied from what I'm using, feel free to tweak them as desired, and don't forget that I'm using /var/log/bitcoind.log for logging the output, depending how everything is setup you might not have write access to it ...
|
|
|
|
zhinkk
|
|
July 17, 2014, 11:28:06 AM |
|
Could you achieve this through the use of a crontab? For example, you can run scripts on boot using the @reboot keyword. So if you wanted to run bitcoind, you could add "@reboot bitcoin -daemon" to your crontab.
|
|
|
|
dserrano5
Legendary
Offline
Activity: 1974
Merit: 1029
|
|
July 17, 2014, 11:31:45 AM |
|
Could you achieve this through the use of a crontab? For example, you can run scripts on boot using the @reboot keyword. So if you wanted to run bitcoind, you could add "@reboot bitcoin -daemon" to your crontab.
That's what I do (but as a regular user, not root).
|
|
|
|
RedDiamond
|
|
July 17, 2014, 01:42:35 PM |
|
/etc/rc.local file is also a place where you can insert commands that need to be executed at boot.
|
|
|
|
Lucky Cris
|
|
July 25, 2014, 07:11:26 AM |
|
Old thread recently bumped... but since it seems it wasn't answered: I run bitcoind and other coinds on my Unbuntu 12.04 server 24/7. You'll need to create .config in the .coin directory. Here's a sample config I use: rpcuser=username rpcpassword=verylongpassword rpcconnect=localhost listen=1 daemon=1 server=1 disablewallet=1
If the coind is moved to /usr/bin directory, you can start from any directory by just typing the coind in terminal: The config I provided ensures the process runs even after you close the terminal. Here's a cool trick (alternative) I recently learned: I use this in my scripts; it releases the process from terminal. For example, if i open Firefox via command line, it'll close when I close my terminal window. But, if I use firefox & disown I can continue to use terminal or close it without it affecting firefox. Hope this helps someone!
|
|
|
|
AliceWonder
|
|
July 25, 2014, 06:11:12 PM |
|
Could you achieve this through the use of a crontab? For example, you can run scripts on boot using the @reboot keyword. So if you wanted to run bitcoind, you could add "@reboot bitcoin -daemon" to your crontab.
That's what I do (but as a regular user, not root). Yup - it's the perfect use for cron. Once an hour or so start the daemon fron cron (as regular user). If daemon already running, no harm. If not running, it will start. Other thing I do is once a day I stop it, sleep for three, and start it with the reindex option - that way if there was a problem with the blocks, it gets fixed.
|
|
|
|
Justin00
Legendary
Offline
Activity: 910
Merit: 1000
★YoBit.Net★ 350+ Coins Exchange & Dice
|
|
July 25, 2014, 10:19:56 PM |
|
You sir, deserve the post of the day award!!! I've been using unix/linux for years now.... never heard of that disown command... It is very cool Thanks for posting that up. Here's a cool trick (alternative) I recently learned: I use this in my scripts; it releases the process from terminal. For example, if i open Firefox via command line, it'll close when I close my terminal window. But, if I use firefox & disown I can continue to use terminal or close it without it affecting firefox. Hope this helps someone!
|
|
|
|
BookLover
|
|
July 26, 2014, 12:12:34 AM |
|
You sir, deserve the post of the day award!!! I've been using unix/linux for years now.... never heard of that disown command... It is very cool Thanks for posting that up. Here's a cool trick (alternative) I recently learned: I use this in my scripts; it releases the process from terminal. For example, if i open Firefox via command line, it'll close when I close my terminal window. But, if I use firefox & disown I can continue to use terminal or close it without it affecting firefox. Hope this helps someone! Mr. Forehead meet Mr. Desk. Great tip, wish I had found this sooner.
|
|
|
|
Lucky Cris
|
|
July 26, 2014, 01:24:12 AM |
|
lol, anytime! I'm just a newbie to it, but I found this treasure tucked away
|
|
|
|
nuno12345
|
|
July 26, 2014, 02:19:29 PM |
|
open a new shell and type: crontab -e crontab should open, type this at the end: @reboot /path/to/bitcoind then hit ctrl+x, yes, enter reboot and type ps xa | grep "bitcoin", should be a line there
|
|
|
|
CryptoPanda
|
|
January 08, 2015, 07:30:09 PM |
|
Yes Lucky Cris advices are a treasure (both of them) It's actually odd this tip about the .conf file is not more widely known But to truly keep it running 24/7 what you guys do for those cases when the process gets killed for some reason? Most often it's ram and no swap situation but I guess it happens sometimes on high ram systems too. So what about those cases? Any smart trick?
|
|
|
|
Reynaldo
Legendary
Offline
Activity: 1143
Merit: 1000
|
|
January 08, 2015, 11:35:54 PM |
|
You can use screen, you open it up then detach that terminal if you think that closing it is killing the process. For more information: https://wiki.archlinux.org/index.php/GNU_ScreenYou can also make a cron to check if its up and then if its not up then re run it. btw nice one at the disown, will try it.
|
|
|
|
Newar
Legendary
Offline
Activity: 1358
Merit: 1001
https://gliph.me/hUF
|
|
January 13, 2015, 12:11:35 PM |
|
Yes Lucky Cris advices are a treasure (both of them) It's actually odd this tip about the .conf file is not more widely known But to truly keep it running 24/7 what you guys do for those cases when the process gets killed for some reason? Most often it's ram and no swap situation but I guess it happens sometimes on high ram systems too. So what about those cases? Any smart trick? Not pretty, but works: A crontab that starts the process every x Minutes. If bitcoind already runs it will do nothing, but a log entry. Another crontab takes care removing that log file every so often. Other options include upstart and monit, both of which I had little success on Ubuntu 12.04. My understanding is upstart is working under 14.04. systemd is now availble on 15.04, but I haven't tinkered with that one yet.
|
|
|
|
|