Harvie/libpurple-core-answerscripts

Scripts in answerscripts.d do not run

Closed this issue · 11 comments

Ever since I changed to the newer version(current one, 30 August 2010), no scripts that I put or any of the default ones, in answerscripts.d, run.

I've tried re-compiling the plugin several times, changing the files to include and exclude the numbers, tried perl, bash etc. No results. The plugin compiles without sending me any errors, it shows up in Pidgin under plugins and is activated. I've tried multiple protocols as well(AIM, MSN, XMPP, IRC)

I use Ubuntu 10.04, 32-bit, pidgin 2.6.6(libpurple 2.6.6), I've tried locating answerscripts.sh in .purple AND in answerscripts.d, no result.

answerscripts.so is located in ~/.purple/plugins
I've attempted manual installation and with the use of make as well(make, make install, make user).

As for how I know the scripts are not being executed, I do not see perl being run when looking at my running processes(for the perl scripts) and there is no output.

I hope this can be fixed. // Someone manages to point out something stupid I forgot to do.

mickcy: Thanks for posting this - I was immediately able to start thinking that this script not working wasn't my problem.

I checked '/.xsession-errors' to see if it was generating any error output, and it was - Harvie is using bash functionality in the main answerscripts script ('/.purple/answerscripts'), however its executed as a standard shell script.

Replace the shebang line with '#!/bin/bash' and it works :)

OmegaPhil: I also checked ~./xsession-errors, for one it was searching for 'answerscripts' and mine was named 'answerscripts.sh' and second '#!/bin/sh' instead of '#!/bin/bash'.
I changed those two, however, I still do not receive output.

To copy the relevant part of the perl script I use:
switch ($ENV{ANSW_MSG}) {
case /^!help$/ {
print "List of commands:\r";
print "!ping\r!whoami\r!reboot\r!google\r!uptime\r!date\r!washing\r";
print "!notification Title,Message\rComma must be used to separate the title and the message, replace Title with a title and Message with your actual message, the message can contain commas.\r\r";
}
...
}

And I checked ~/.xsession-errors again now, no errors and no output. ;-;
The perl script is named '01-menu.pl'
And it did work before, all I changed was the '$ENV{ANSW_MSG}' part.
Using '00' or '01' as numbers doesn't work, I will attempt delayed now as well.
Edit: Yeah, delayed doesn't work either. I attempted: 49,50,53,99

I'm not able to help you with particular scripts (havent used bash etc long myself, never touched perl). All I can confirm is that the main bash script the plugin executes that then executes all the user scripts was broken, and after I fixed it I successfully got scripts executing in my case.

I guess youve already proved that no scripts are being executed? If not, why not try a bash script which calls logger (use it to create syslog messages), or perhaps zenity?

answerscripts did not have a '.sh' extension in my case (Ubuntu Server box here), I compiled+installed from fresh yesterday.

Any idea how to get emails when someone posts here?

You get an email if you 'watch' this project.
(at least I do)
And I managed to get it to work again, after changing the filename from 'answerscripts.sh' to 'answerscripts', the plugin magically got disabled, I re-enabled it and now it works again.

To clarify:
'answerscripts' and mine was named 'answerscripts.sh' and second '#!/bin/sh' instead of '#!/bin/bash'
Fixing those two fixed it for me. I only had the plugin disabled, which was why they didn't work.

Great, nice to hear it works for you. I am watching this project, and every config is set to email me, but I'm getting no emails. Nevermind.

Hmm, since this is fixed now, I will Comment&Close it.

Its not closed - Harvie needs to fix the source presumably?

Its not closed - Harvie needs to fix the source presumably?

Ah, but it will still show up here which he is bound to check -at some point in time-
If not, just mention it in some comment which he will read. Which I will do anyway if it takes long.

Well i will change /bin/sh to /bin/bash (on my distro sh is symlink to bash).
are there another issues beside the hashbang?

i can suggest you to NOT copy the files to ~/.purple manualy, but you should use
$ make user
instead. this will also rename answerscripts.sh to answerscripts.

let me know if problem still persist

Also note that there are new rules for naming files in answerscripts.d...
please check the main answerscript (answersripts.sh) for up-to date info.

# Maybe you will want to add more hooks for receiving messages, so i've made following script
# - It just executes all +x files in answerscripts.d directory so you should do your magic there
# - To disable some of those scripts simply use: chmod -x ./script
# - There is some basic structure, which means that all scripts should start their names with two-digit number
# - Files are executed in order specified by those numbers and some numbers have special meanings:
#   - AB?!_ scripts without numbers are NOT executed!
#   - 00    executed immediately, zero or single line output (parallel async processing)
#   - 01-48 executed immediately, multiline output (serial processing)
#   - 49    delay script (adds random delay to emulate human factor)
#   - 50    executed after delay, zero or single line output (parallel async processing)
#   - 51-79 executed after delay, multiline output (serial processing)
#   - 80-99 reserved for future

@Harvie
I already knew the new rules for naming files. Thanks anyway.
Everything works now as it should too. <3