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