What paths does TVHeadend know?

Ok folks, here’s one for the linux experts.

I got a shell script “test.sh” which is stored in the home folder and marked executable for everyone in the fs:

It is installed via symlink to /usr/bin as “testscript”:

And as you would expect the symlinks target is accessible and executable:

I can run the script from command line by just typing “testscript” and it works as expected. BUT if I enter it as post processing script in TVHeadend only as “testscript” (without path) it is not started. If I set the post script to “/usr/bin/testscript” it works. I took the time and read the $PATH variable from within TVH and it is “/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/usr/osmc/bin:/opt/vc/bin”

So my question is: why can’t the script be run without path? I had expected it should.

Do you have !#/bin/bash at the start of your test.sh script? That may be needed so TVH knows how to run it.

Yes. In search of the error I stripped it down to the bare minimum. It only contains 2 lines now:

#! /bin/bash
echo $(date ‘+%d.%m.%Y %H:%M:%S’) : $PATH >> /home/osmc/testlog.txt

  1. Your symlink is to /etc/alternatives/testscript, not /home/osmc/test.sh??
  2. What do mean ‘read the $PATH variable from within TVH’? Is there a console mode?
  3. You might do better to ask this at the TVH forum.
  1. I installed the script with “update-alternatives” so there’s a symlink in /usr/bin pointing to /etc/alternatives/testscript which is a symlink pointing to the actual file.

  2. I called the script with path from TVH. As you can see above it writes $PATH to a file. I’m not aware of any console, but that would sure make things easier.

  3. Had thought this to be more of a user/service/environment topic so placed it here.

The most obvious answer to this would be that TVHeadend doesn’t use PATH for post processing scripts. Instead, it expects a full path to the script or program to be executed.

Yeah that’d be too obvious! :wink:

Oddly enough tho if I place that exact file itself in /usr/bin and not just a symlink, TVH runs it without path.

So first of all I’d be greatly relieved if you say I didn’t miss a major point and in theory all should work the way it is set up. Then of course it really seems to be a TVH issue.

Pretty sure symlinks are the problem.
Try symlinking to from a /usr/bin/foo to /usr/bin/bar. Both will be in PATH. If that works, /etc not being in path is the issue.

A good point. I placed “test.sh” in /usr/bin and symlinked “/usr/bin/testscript” to it. Running testscript works from command line, doesn’t work from TVH.

Then you have your answer :slight_smile:

Relieve and disappointment at the same time. :joy: