I want to stop kodi from a script, but I am getting an error I can’t explain:
when I enter “sudo systemctl stop mediacenter” on the command-line kodi stops, but when I enter
this in a script, I get this error : Failed to stop mediacenter\x0d.service: Unit mediacenter\x0d.service not loaded.
what am I doing wrong?
Hard to know, without seeing the script and knowing how the script is executed
Did you write the script in an editor that uses Linux line endings ? That looks suspiciously like a carriage return after mediacenter. Linux scripts must always use LF only for end of lines.
Yes, thanks. That was it. Once I opened it in VI, there where ^M’s at the end of the line.
Removed them and saved the file, and it worked. Great.