PromyLOPh / pianobar

Console-based pandora.com player
http://6xq.net/pianobar/
Other
1.74k stars 321 forks source link

Running Pianobar Headless #606

Closed MggMuggins closed 7 years ago

MggMuggins commented 7 years ago

A thousand and one apologies if this is a duplicate, but I don't really want to go through all 500 issues on this repo... Anyway, I'm making a Pandora's Box (ackhem, have made), and running it on a C.H.I.P.(https://getchip.com). Pianobar is working great when I run it through an ssh connection, but I tried adding it to rc.local and nothing. My hypothesis is that the rc.local file ran pianobar as root (it did, I checked top to make sure), and the config that I used to fix the tls fingerprint fixed and get it to automatically sign in is involved with the chip user (default user, and in this case, the only other user on the board). It works fine with the config and fifo that I made for the chip user, but I wasn't able to get it to run headless. Any ideas? Thanks for reading.

PromyLOPh commented 7 years ago

[…] but I don't really want to go through all 500 issues on this repo... A pretty bad excuse, if you ask me. There’s a search box at the top of the site ;)

Have a look at contrib/headless_pianobar and pianod (http://deviousfish.com/pianod/).

MggMuggins commented 7 years ago

Yeah, I was wishing there were a better one :P (correction, 600 issues :P)

I took a look at those and I think it could maybe be made to work, but it would be a whole lot more work than I'd really like to do, if there were an easier way to make pianobar run under the chip user from the start. When I just put pianobar in rc.local, the command ran, but had the problem I encountered above (Could see this with top). However, when I put su chip pianobar instead, pianobar didn't run at all. Any ideas? I'd really like to avoid complications if at all possible. Thanks, and sorry for being unwilling to accept perfectly valid solutions. :P

ThreepE0 commented 7 years ago

I know this may not be the most straightforward or simple way to do what you're trying to do, but I'd consider using the forever-service npm package to set pianobar up as a service. Among other things, it allows you to output logging to the file of your choice, and run as a specific user. It can also recover automatically in the event of a crash. I'd be happy to help set it up if have any other questions.

PromyLOPh commented 7 years ago

Looking at the manpage su -c pianobar chip should be the correct syntax. Aside from that you may have to start pianobar with nohup (see headless_pianobar line 102), since it expects a working TTY.

MggMuggins commented 7 years ago

And thanks, I'll look at that. My guess is that it's just a scripting problem that I'm not aware of. We did sudo -u chip pianobar to no avail. However, we did revert the output into a log file so we could see what was going on. A DNS lookup error, no matter how long we waited before having the script run, and regardless of the permissions. I'll give nohup a shot.