I come here seeking for advice desperately, as my mind has started to
boil and is going to explode. But let me explain my problem.
I use Pidgin, which is built ontop of libpurple, as my IM client.
Libpurple comes with a handy script purple-remote, which allows user
to control it from console, for example, change status. So I thought
it would be useful to add "purple-remote setstatus?status=away" to the
file motion-end.sh, which is set as on_event_end command. Remembering
that motion will run it as the user who launched motion, i.e. root, I
typed "sudo motion-end.sh" and got an error: "No existing libpurple
instance detected." Adding "sudo -u max" in front of "purple-remote
..." seemingly solved the problem, as "sudo motion-end.sh" now worked
like charm. But when motion-end.sh is run by motion on event end, it
still fails with the very same error.
Could someone explain me what is going on? Please?..