Author

Topic: [Back to not solved] Block notify refusing to execute script (Read 4188 times)

newbie
Activity: 2
Merit: 0
Ok, wow...

So do you specify this in the conf file
Code:
blocknotify=/home/bitcoin/block.sh %s

and in the block.sh file:
Code:
#!/bin/sh
code goes here

not sure if I should use dh or bash and if I should call the .sh file direct or via blocknotify=/bin/sh /home/bitcoin/block.sh %s

How are you doing this?
full member
Activity: 238
Merit: 109
and do use an absolute path.

Do not use an absolute path?

Reread, he said do use Wink.

Whoops, well, I've also tried (Which was working till it randomly stopped, includes hashbang to /bin/sh):-
Code:
/home/bitcoin/block.sh %s

I'm unsure how how to use an absolute path of sh or something of the like without quotes, as, the space for the argument would break it:-
Code:
/bin/sh -c /home/bitcoin/block.sh%s

I'd need:-
Code:
/bin/sh -c "/home/bitcoin/block.sh %s"

EDIT:- This was the .conf that worked just fine, until, well, it randomly stopped working without me updating anything (System, .conf, bitcoin, .sh, anything!):-
Code:
rpcuser=no.
rpcpassword=no.
maxconnections=1000
checklevel=4
keypool=10000
rpcallowip=127.0.0.1
server=1
blocknotify=/home/bitcoin/block.sh %s
walletnotify=/home/bitcoin/wallet.sh %s
alertnotify=/home/bitcoin/alert.sh %s


I have the exact same problem. Did you solve it?

I did, but, I had absolutely nothing to do with it, one day it just started working. Sorry.
newbie
Activity: 2
Merit: 0
and do use an absolute path.

Do not use an absolute path?

Reread, he said do use Wink.

Whoops, well, I've also tried (Which was working till it randomly stopped, includes hashbang to /bin/sh):-
Code:
/home/bitcoin/block.sh %s

I'm unsure how how to use an absolute path of sh or something of the like without quotes, as, the space for the argument would break it:-
Code:
/bin/sh -c /home/bitcoin/block.sh%s

I'd need:-
Code:
/bin/sh -c "/home/bitcoin/block.sh %s"

EDIT:- This was the .conf that worked just fine, until, well, it randomly stopped working without me updating anything (System, .conf, bitcoin, .sh, anything!):-
Code:
rpcuser=no.
rpcpassword=no.
maxconnections=1000
checklevel=4
keypool=10000
rpcallowip=127.0.0.1
server=1
blocknotify=/home/bitcoin/block.sh %s
walletnotify=/home/bitcoin/wallet.sh %s
alertnotify=/home/bitcoin/alert.sh %s


I have the exact same problem. Did you solve it?
full member
Activity: 238
Merit: 109
and do use an absolute path.

Do not use an absolute path?

Reread, he said do use Wink.

Whoops, well, I've also tried (Which was working till it randomly stopped, includes hashbang to /bin/sh):-
Code:
/home/bitcoin/block.sh %s

I'm unsure how how to use an absolute path of sh or something of the like without quotes, as, the space for the argument would break it:-
Code:
/bin/sh -c /home/bitcoin/block.sh%s

I'd need:-
Code:
/bin/sh -c "/home/bitcoin/block.sh %s"

EDIT:- This was the .conf that worked just fine, until, well, it randomly stopped working without me updating anything (System, .conf, bitcoin, .sh, anything!):-
Code:
rpcuser=no.
rpcpassword=no.
maxconnections=1000
checklevel=4
keypool=10000
rpcallowip=127.0.0.1
server=1
blocknotify=/home/bitcoin/block.sh %s
walletnotify=/home/bitcoin/wallet.sh %s
alertnotify=/home/bitcoin/alert.sh %s
legendary
Activity: 1974
Merit: 1029
full member
Activity: 238
Merit: 109
If you are specifying these parameters in the config file, don't use quotes, and do use an absolute path. Now that you've fixed the other issue!

Do not use an absolute path? Then, what's the current directory I'm in? The directory I run bitcoind from? $HOME/.bitcoin?

I have issues even if I just do:-
Code:
blocknotify=echo %s

Which, isn't absolute, nor does it contain quotes, so, same issue.
sr. member
Activity: 412
Merit: 287
If you are specifying these parameters in the config file, don't use quotes, and do use an absolute path. Now that you've fixed the other issue!
full member
Activity: 238
Merit: 109
This issue has popped back up, not changed anything. Great.
full member
Activity: 238
Merit: 109
Well, I worked it out. Apparently there was an error else-where in my config that was fucking everything up. Woohoo, non-useful error messages are non-useful.

Code:
[bitcoin@steam ~]$ tail -f block.log
0000000000000000eeae3316441fa75980bb33da1ebec31d385dcd50b57e119f
000000000000000268d3f985177f9fbc1cce0bd80f5805e0f4be76de77119cf5
000000000000000197869993938d0de0428b6eada0ac84c3f31df9a516224e39
0000000000000002e05bba63e09de100aeed19f9b0b58342aecd87b8ca7e7598
000000000000000208bc53df9cdd467a506a11c2596fd452aa64e353262cdb48

For later reference, if someone is googling this, the issue was that "wallet" and "alert" notify were _APPARENTLY_ formatted incorrectly (despite looking okay when viewing 'em), once deleting those two entries everything works.
full member
Activity: 238
Merit: 109
SE?
Any other errors popping up in /var/log/* ?
What is your walletnotify= line in your .conf?

I've tried a hell of a lot of wallet notifies so far, including, but not limited to:-
Code:
blocknotify=/tmp/block.sh
Code:
blocknotify="/tmp/block.sh"
Code:
blocknotify=/home/bitcoin/block.sh "%s"
Code:
blocknotify="/home/bitcoin/block.sh" "%s"
Code:
blocknotify="/home/bitcoin/block.sh" %s
Code:
blocknotify=/home/bitcoin/block.sh %s
Code:
blocknotify="/bin/bash" "/home/bitcoin/block.sh" "%s"
Code:
blocknotify="/bin/sh" "/home/bitcoin/block.sh" "%s"

Running:-
Code:
journalctl -f

and initiating bitcoind again resulted in nothing new being dumped to journalctl.
kjj
legendary
Activity: 1302
Merit: 1026
SE?
Any other errors popping up in /var/log/* ?
What is your walletnotify= line in your .conf?
full member
Activity: 238
Merit: 109
Execute bit set?

Code:
[bitcoin@steam ~]$ ls -ls
total 12
4 -rwx------ 1 bitcoin bitcoin 37 Dec 25 20:14 alert.sh
4 -rwx------ 1 bitcoin bitcoin 47 Dec 25 23:15 block.sh
4 -rwx------ 1 bitcoin bitcoin 38 Dec 25 20:14 wallet.sh

I even went through with the time to compile a c++ app that simply called (As, from the log, this seems to be the function bitcoind calls):-
Code:
system("/home/bitcoin/block.sh thisisarandomhash");

And it worked fine, I also tried copying block.sh to /tmp/block.sh, and, giving it 777 perms:-
Code:
[bitcoin@steam .bitcoin]$ tail -f debug.log | grep block.sh
2013-12-26 14:37:27 runCommand error: system("/tmp/block.sh") returned -1
2013-12-26 14:37:28 runCommand error: system("/tmp/block.sh") returned -1
2013-12-26 14:37:29 runCommand error: system("/tmp/block.sh") returned -1
2013-12-26 14:37:29 runCommand error: system("/tmp/block.sh") returned -1
2013-12-26 14:37:29 runCommand error: system("/tmp/block.sh") returned -1
kjj
legendary
Activity: 1302
Merit: 1026
Execute bit set?
full member
Activity: 238
Merit: 109
Your block.sh isn't a valid executable. It needs to start with a #! line or be executed by a shell explicitly.

I tried specifically calling it via bash, didn't work. Added a hashbang to the start of the shell script, see if that works.

EDIT:-
Code:
2013-12-25 23:12:50 runCommand error: system(/home/bitcoin/block.sh 000000000000000275f2223e520067759159e83be4f23e6f21b9661a54e27efc) returned -1

Code:
[bitcoin@steam .bitcoin]$ cat /home/bitcoin/block.sh
#!/usr/bin/env bash
echo "$@" >> /home/bitcoin/block.log

EDIT:-
Code:
2013-12-25 23:23:57 runCommand error: system(/home/bitcoin/block.sh 00000000000000003788ac3db98f21b99151ea65711b53686e1ad3583bd1a2a1) returned -1

Code:
[bitcoin@steam .bitcoin]$ cat /home/bitcoin/block.sh
#!/bin/sh
echo "$@" >> /home/bitcoin/block.log
administrator
Activity: 5222
Merit: 13032
Your block.sh isn't a valid executable. It needs to start with a #! line or be executed by a shell explicitly.
full member
Activity: 238
Merit: 109
Log from bitcoind:-
Code:
2013-12-25 20:17:10 runCommand error: system(/home/bitcoin/block.sh 0000000000000001add7cf0bbc4520992f0c9f4346391273f27a93513a806a27) returned -1
2013-12-25 20:24:11 runCommand error: system(/home/bitcoin/block.sh 000000000000000136b5f4be351bd98d799a71c649a502c209e99a284650f2b3) returned -1
2013-12-25 20:32:24 runCommand error: system(/home/bitcoin/block.sh 00000000000000022f1d81992f0ca2b1bd658075a61103155a63201e208e5583) returned -1
2013-12-25 20:40:50 runCommand error: system(/home/bitcoin/block.sh 0000000000000002217553b052adbf99474d83aea9b1333e5035868ddbc13bd1) returned -1
2013-12-25 20:51:24 runCommand error: system(/home/bitcoin/block.sh 000000000000000011071fde5c66d3c5c50b88795665bd51858b1a4aada4d27b) returned -1
2013-12-25 20:51:51 runCommand error: system(/home/bitcoin/block.sh 0000000000000003064199f07fbc4fcadc7894403983525f77e2b447289eb9d6) returned -1
2013-12-25 20:54:32 runCommand error: system(/home/bitcoin/block.sh 000000000000000202e23278efb3fea7c261ee7186de389e1594285f54bbf85c) returned -1
2013-12-25 20:59:44 runCommand error: system(/home/bitcoin/block.sh 000000000000000349b3b84fedc6be1a7ebd20f27377d08f2fda2f1036e83af1) returned -1
2013-12-25 21:05:37 runCommand error: system(/home/bitcoin/block.sh "0000000000000002591fda47c52e3f816031328bdbfeb9f68d67eebb9968baa8") returned -1
2013-12-25 21:05:38 runCommand error: system(/home/bitcoin/block.sh "0000000000000002e14e03f1162885d74e1d39c9016401e537c9a62c2558d158") returned -1
2013-12-25 21:14:39 runCommand error: system(/home/bitcoin/block.sh "000000000000000374a7b6359cc993d3638c72c14d8c7529fef7e6e7e545bffb") returned -1
2013-12-25 21:27:20 runCommand error: system("/home/bitcoin/block.sh 00000000000000034091377f6269b6ac3efaecb5e84f9d7358a851a08241a3dd") returned -1
2013-12-25 21:43:21 runCommand error: system("/home/bitcoin/block.sh 00000000000000002df90422830562c3435520d69a1d51689acbb1253ba5ae3e") returned -1
2013-12-25 22:00:58 runCommand error: system("/home/bitcoin/block.sh 0000000000000000e54087f1dbb7c0d2c5bf29cd20906ad458417ea977e03b4e") returned -1
2013-12-25 22:16:59 runCommand error: system("/home/bitcoin/block.sh 0000000000000003521d838126ca43cb8ac4dd6f4f5f5e290b8efbb6e11fd2c9") returned -1

As you can see, I've tried lots of configurations. Here's me running the command myself:-
Code:
[bitcoin@steam .bitcoin]$ /home/bitcoin/block.sh "000000000000000374a7b6359cc993d3638c72c14d8c7529fef7e6e7e545bffb"
[bitcoin@steam .bitcoin]$

As you can see, works fine:-
Code:
[bitcoin@steam ~]$ cat block.log
000000000000000374a7b6359cc993d3638c72c14d8c7529fef7e6e7e545bffb

The block.sh:-
Code:
[bitcoin@steam ~]$ cat block.sh
echo "$@" >> /home/bitcoin/block.log

Any help? I can't work out why it refuses to run.

EDIT:- Nor this:-
Code:
2013-12-25 22:53:32 runCommand error: system("/usr/bin/bash" "/home/bitcoin/block.sh" "00000000000000025efa4d291485de8c34136c3d0d6b2cfd487514b4f81c27c5") returned -1
Jump to: