DavinciJ15 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 07, 2011, 05:24:50 AM Last edit: August 16, 2011, 06:12:33 PM by DavinciJ15 |
|
So I googled found many ways to get things started but none of them worked. Let me show you one way that I though should be basic and work... I opened up the file /etc/rc.local Looks like this... #!/bin/sh # # This script is executed at the end of each multiuser runlevel.
/home/bitcoinpool/namecoin/namecoind -daemond & /home/bitcoinpool/pushpool/pushpoold --config=/home/bitcoinpool/pushpool/server.json &
Exit 0
When I reboot nothing. Please help and get paid in full!
|
|
|
|
jondecker76
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 07, 2011, 06:07:01 AM |
|
What distro are you using? I ask because some distros use /etc/rc.d/rc.local. Was /etc/rc.local already there and you added to it, or did you create it yourself? You could also do some simple debugging to see if your script is ever being executed. Something simple like: echo "Yep, it executed!" > /home/bitcoinpool/debug.txt Then after a reboot you can see if it made the debug.txt.file
|
|
|
|
jondecker76
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 07, 2011, 06:36:16 AM |
|
One other thing to mention. Some scripts need to run as the correct user (so that they know where their hidden data directory is). If I were you, I would change the script to look like the example below, so that they execute as the correct user (and not as root): #!/bin/sh # # This script is executed at the end of each multiuser runlevel.
su bitcoinpool -c /home/bitcoinpool/namecoin/namecoind -daemond & su bitcoinpool -c /home/bitcoinpool/pushpool/pushpoold --coinfig=/home/bitcoinpool/pushpool/server.json &
Exit 0
|
|
|
|
Bitsky
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 07, 2011, 07:00:56 AM |
|
To capture all output (stdout+stderr), you can append ">> /var/log/bitcoinpool.log 2>&1". Also, check your standard logs (messages, cron) for additional error messages.
In most cases such scripts fail because of relative paths. Cron has a different environment.
|
|
|
|
Bitsky
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 07, 2011, 07:09:06 AM |
|
Also...
I assume you don't mean "coinfig", but "config"
|
|
|
|
nodemaster
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 07, 2011, 07:34:27 AM |
|
Using rc.local you "fire-and-forget" the daemon. UNIX style is to have an init script which you can use in order to start, stop and restart daemons. Furthermore the init process will start the daemons for you if you linked the init script to the appropriate runlevel(s) and stops them properly if you reboot/halt the server. With this knowledge you should have a look at this thread: http://bitcointalk.org/?topic=965.0and adapt it to your needs. It should help you doing it the "right" way. Do the same for pushpoold. If you like you can tip the original author.
|
|
|
|
error
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 07, 2011, 06:40:00 PM |
|
Also, "daemon" is misspelled.
|
3KzNGwzRZ6SimWuFAgh4TnXzHpruHMZmV8
|
|
|
antares
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 07, 2011, 09:39:23 PM |
|
So I googled found many ways to get things started but none of them worked. Let me show you one way that I though should be basic and work... I opened up the file /etc/rc.local Looks like this... #!/bin/sh # # This script is executed at the end of each multiuser runlevel.
/home/bitcoinpool/namecoin/namecoind -daemond & /home/bitcoinpool/pushpool/pushpoold --coinfig=/home/bitcoinpool/pushpool/server.json &
Exit 0
When I reboot nothing. Please help and get paid in full! Heres what you need: create the following script: #!/bin/sh # Starts and stops namecoin + pushpool #
case "$1" in start) /home/bitcoinpool/namecoin/namecoind -daemon -server /home/bitcoinpool/pushpool/pushpoold --config=/home/bitcoinpool/pushpool/server.json & ;;
stop) killall namecoind pushpoold ;;
restart) $0 stop $0 start ;;
*) echo "Usage: $0 {start|stop|restart}" exit 1 esac save the script under /etc/init.d/somenameyoucanchooseyourself now, make the script executable: chmod +x /etc/init.d/somenameyoucanchooseyourself if you use a debian like system(ie debian, ubuntu etc), you can enable this script to run at boot using: update-rc.d somenameyoucanchooseyourself defaults
|
|
|
|
twobits
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 08, 2011, 06:11:28 PM Last edit: August 08, 2011, 07:13:47 PM by twobits |
|
So I googled found many ways to get things started but none of them worked. Let me show you one way that I though should be basic and work... I opened up the file /etc/rc.local Looks like this... #!/bin/sh # # This script is executed at the end of each multiuser runlevel.
/home/bitcoinpool/namecoin/namecoind -daemond & /home/bitcoinpool/pushpool/pushpoold --coinfig=/home/bitcoinpool/pushpool/server.json &
Exit 0
When I reboot nothing. Please help and get paid in full! Linux does not define the runlevel start up scripts, depends on the specific userland as to how that is set up. Just which init set up is being used? What are you running specifically? Also, the above runs everything as root, not a great idea. I would run namecoid as its own user, probably in a chrooted jail. In any case, a lot of Linux set up use vixie cron... in that case create a user for running this ( myncduser or whatever). Add them to cron.allow if need be. # crontab -u myncduser -e then add the line @reboot /home/bitcoinpool/namecoin/namecoind -daemond or better yet, put it in a script that can restart it if it fails, actually if this is for production use, look into something like daemontools or runit iinstead.
|
█████ █████ ███████ █████ ███ █████████████ █████ ██ █████████████████ █████ █ ██████ ██████ █████ ████ ████ █████████████ █████ ████ █████████████ █████ ████ █████████████ █████ ████ █████ █████ █████ █ ██████ ███████ █████ ██ ███████████ █████ █████ ███ █████████ ████ █████ █████ ███████ ██ | | | ███ ███ ███ ███ ███ ███ ███ ███ ███ | | | | | | ███ ███ ███ ███ ███ ███ ███ ███ ███ | | ►WhitePaper ►One-Pager | ███ ███ ███ ███ ███ ███ ███ ███ ███ | | | | ███ ███ ███ ███ ███ ███ ███ ███ ███ | | ███ ███ ███ ███ ███ ███ ███ ███ ███ | █████ █████ ███████ █████ ███ █████████████ █████ ██ █████████████████ █████ █ ██████ ██████ █████ ████ ████ █████████████ █████ ████ █████████████ █████ ████ █████████████ █████ ████ █████ █████ █████ █ ██████ ███████ █████ ██ ███████████ █████ █████ ███ █████████ ████ █████ █████ ███████ ██ |
|
|
|
|
kseistrup
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 08, 2011, 06:52:29 PM |
|
or better yet, put it in a script that can restart it if it fails, actually if this is for production use, look into something like daemontools or runit iinstead.
Some linuxes (ubuntu comes to mind) use upstart, so all you have to do is drop a properly formed script in /etc/init. E.g.: # bitcoind
description "Keep bitcoind in the air"
start on (filesystem and runlevel [2345] and started rsyslog and net-device-added INTERFACE=eth0)
stop on (shutdown or runlevel [!2345])
pre-start script /usr/bin/logger -t upstart starting bitcoind end script
post-start script /usr/bin/logger -t upstart started bitcoind end script
env LANG=C env LC_ALL=C env HOME=/var/lib/bitcoin
export LANG export LC_ALL export HOME
chdir /var/spool/bitcoin umask 0077 nice 10
kill timeout 45
script exec /usr/bin/sudo -H -u bitcoin \ /usr/local/sbin/bitcoind -datadir=/var/spool/bitcoin -server end script
respawn
pre-stop script /usr/bin/logger -t upstart stopping bitcoind exec /usr/local/sbin/bitcoind stop end script
post-stop script /usr/bin/logger -t upstart stopped bitcoind end script
# eof
(The script make assumptions about where to find bitcoind, what user to run as, wich network interface to use, etc.) Cheers,
|
Klaus Alexander Seistrup
|
|
|
DavinciJ15 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 10, 2011, 06:22:34 PM |
|
Thanks for all the solutions I will try them all and give the reward to the first person that got it right. I am 100% sure that syntax errors will cause it to fail ether by me or in your comment.
BTW I am using ubuntu server 11.04.
|
|
|
|
DavinciJ15 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2011, 07:12:21 PM |
|
I have tried every single option none of them work I am missing stuff like what user run it under or whatever I'll have to figure it out.
The /etc/init.d/myscriptname was helpful as I can manually stop and start it. Thanks!
|
|
|
|
Bitsky
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2011, 07:31:49 PM |
|
Haven't used Ubuntu that often, but if I remember correctly you can have a service start automatically at boot with something like "update-rc.d myscriptname defaults" as root. Or you can symlink to the script in init.d from rc3.d/S99myscriptname (don't forget that you probably also need to symlink rc1.d/K99myscriptname). Don't forget to look into logs for error messages.
|
|
|
|
DavinciJ15 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2011, 07:54:37 PM |
|
Haven't used Ubuntu that often, but if I remember correctly you can have a service start automatically at boot with something like "update-rc.d myscriptname defaults" as root. Or you can symlink to the script in init.d from rc3.d/S99myscriptname (don't forget that you probably also need to symlink rc1.d/K99myscriptname). Don't forget to look into logs for error messages.
I did the "update-rc.d myscriptname defaults" as root rebooted and nothing started. Just so you know I have no idea where the logs are.
|
|
|
|
Bitsky
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2011, 08:54:18 PM |
|
Hm, can you post the script you use?
Did you get any output when you did the update-rc.d? Undo the previous: update-rc.d myscriptname remove Set runlevels manually: update-rc.d myscriptname start 13 stop 06 Look into /etc/rc3.d/ to see if there's a symlink to your /etc/init.d/myscriptname
Logs should go into /var/log/. Usually, there's messages, boot, syslog or something similar which might contain some information about why the service start fails. dmesg perhaps too. I'm running out of ideas sadly though, since Ubuntu isn't my preferred Linux distro. Oh, and you are in runlevel 3, right? Check with "who -r".
And "/etc/init.d/myscriptname start" works just fine when you do it manually? What user are you when doing that? Root?
|
|
|
|
DavinciJ15 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2011, 10:35:00 PM |
|
Hm, can you post the script you use?
Did you get any output when you did the update-rc.d? Undo the previous: update-rc.d myscriptname remove Set runlevels manually: update-rc.d myscriptname start 13 stop 06 Look into /etc/rc3.d/ to see if there's a symlink to your /etc/init.d/myscriptname
Logs should go into /var/log/. Usually, there's messages, boot, syslog or something similar which might contain some information about why the service start fails. dmesg perhaps too. I'm running out of ideas sadly though, since Ubuntu isn't my preferred Linux distro. Oh, and you are in runlevel 3, right? Check with "who -r".
And "/etc/init.d/myscriptname start" works just fine when you do it manually? What user are you when doing that? Root?
Thanks. For your help if we get it going I'll pay you the BTC. Anyhow I'm not in front of the computer right now but to test, and verify all the things you ask. However i can tell you that "/etc/init.d/myscriptname start" works just fine and I am happy about that. But if I run it as a user and not root it fails as namcoind try's to read the data from /home/username/.namecoin instead of /root/.namecoin Bummer. As chown to the /root/.namecoin does not work. I guess I have to do some sort of linking of the folders.
|
|
|
|
Bitsky
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
August 16, 2011, 11:06:41 PM |
|
Some things that come to mind: - perhaps namcoind has an option to specify the data directory (bitcoin has, I'm using that) - symlink (ln -s) or hardlink (mount -o bind) those directories (hardlinks need to go into /etc/fstab too iirc)
|
|
|
|
DavinciJ15 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 01, 2011, 11:44:06 PM |
|
Back to the restart problem that has not been fixed yet. Here is a copy of my script... (remember I am not a linux user in fact the last 30 days it the most I have used linux in my whole life.) #!/bin/sh # Starts and stops namecoin & pushpool & blkmond #
case "$1" in start) echo "" echo "Starting namecoind and pushpool" echo "" /home/ubuntu/namecoin/namecoind -daemon -server sleep 1 /home/ubuntu/pushpool/pushpoold --config=/home/ubuntu/pushpool/server.json screen -dmS blkmond /home/ubuntu/pushpool/blkmond /home/ubuntu/pushpool/blkmond.conf $0 view
;;
stop) echo "" echo "Killing pushpoold then Stoping namecoin"
killall pushpoold killall blkmond /home/ubuntu/namecoin/namecoind stop ;;
restart) $0 stop sleep 4 $0 start ;;
view) ps -e | grep namecoind ps -e | grep pushpoold ps -e | grep blkmond ;;
*) echo "Usage: $0 {start|stop|restart}" exit 1 esac
This (/etc/init.d/namecoin start;) needs to be executed as root under ubuntu 11.04 this should be easy PLEASE help. I have to ask since I have and major issues everywhere else and was able to resolve it but this eludes me? WTF? BTW the script works.
|
|
|
|
DavinciJ15 (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 01, 2011, 11:49:14 PM Last edit: September 02, 2011, 12:13:03 AM by DavinciJ15 |
|
Why did this not work? update-rc.d namecoin defaults; running it again gives me this... update-rc.d namecoin defaults update-rc.d: warning: /etc/init.d/namecoin missing LSB information update-rc.d: see <http://wiki.debian.org/LSBInitScripts> System start/stop links for /etc/init.d/namecoin already exist.
Reboot gives me JAKE STINK ALL. WTF? running as su manually /etc/init.d/namecoin start; give me what I want the start up to do! BTW pushpoold is the only thing that is running after reboot.
|
|
|
|
jfreak53
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
September 02, 2011, 12:10:57 AM |
|
PM me and for 1.5 BTC I can work on it personally or have one of our techs do it since we run those services all the time on our servers and are used to them. (1.5 because of the low price of the BTC right now)
What we can also do is run a screen session so you can watch how we fix it in real-time so you know exactly what we did also.
Just would need SSH login information for the server in question and root access.
|
█ █ microtronixdc.com - Performance VPS, Dedicated Servers, Colocation, Full-Rack options! Massive Network Bandwidth options with Fiber throughout! Always-On DDoS Mitigation for all traffic!
|
|
|
|