Bitcoin Forum
May 30, 2024, 09:40:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Back to not solved] Block notify refusing to execute script  (Read 4165 times)
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
December 25, 2013, 10:22:58 PM
Last edit: February 05, 2014, 04:55:05 PM by Automatic
 #1

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

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
theymos
Administrator
Legendary
*
Offline Offline

Activity: 5208
Merit: 13026


View Profile
December 25, 2013, 10:54:01 PM
 #2

Your block.sh isn't a valid executable. It needs to start with a #! line or be executed by a shell explicitly.

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
December 25, 2013, 10:57:17 PM
Last edit: December 25, 2013, 11:25:22 PM by Automatic
 #3

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

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
December 26, 2013, 05:59:47 AM
 #4

Execute bit set?

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
December 26, 2013, 02:37:41 PM
 #5

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

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
December 26, 2013, 03:12:21 PM
 #6

SE?
Any other errors popping up in /var/log/* ?
What is your walletnotify= line in your .conf?

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
December 26, 2013, 03:24:48 PM
Last edit: December 26, 2013, 03:35:02 PM by Automatic
 #7

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.

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
December 26, 2013, 04:53:34 PM
 #8

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.

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
February 05, 2014, 04:54:47 PM
 #9

This issue has popped back up, not changed anything. Great.

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 275


View Profile
February 07, 2014, 09:01:24 PM
 #10

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!

Bitwasp Developer.
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
February 07, 2014, 09:32:51 PM
 #11

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.

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
dserrano5
Legendary
*
Offline Offline

Activity: 1974
Merit: 1029



View Profile
February 07, 2014, 09:49:45 PM
 #12

and do use an absolute path.

Do not use an absolute path?

Reread, he said do use Wink.
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
February 08, 2014, 12:18:31 AM
 #13

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<SpaceHereWouldBreakArgumentsBeingParsedToTheBashScript>%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

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
nicon
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
November 18, 2014, 10:39:28 AM
 #14

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<SpaceHereWouldBreakArgumentsBeingParsedToTheBashScript>%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?
Automatic (OP)
Full Member
***
Offline Offline

Activity: 238
Merit: 105


View Profile
November 18, 2014, 01:47:53 PM
 #15

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<SpaceHereWouldBreakArgumentsBeingParsedToTheBashScript>%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.

Please ask for a signed message from my on-site Bitcoin address (Check my profile) before doing any offsite trades with me.
nicon
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
November 18, 2014, 05:00:26 PM
 #16

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?
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!