SOLVED pidfile in rc.d script

Status
Not open for further replies.

FlyingPersian

Patron
Joined
Jan 27, 2014
Messages
237
Hi
I'm running subsonic in a jail and installed it according to this thread. The startup script does not have a pidfile, so using service subsonic restart won't work. I've edited the script a little bit. I changed the subsonic_bin to my actual path, so that I don't need to define it in /etc/rc.conf, and added pidfile="/var/run/${name}.pid". Here the full script:

Code:
#!/bin/sh
#
# PROVIDE: subsonic
# REQUIRE: LOGIN DAEMON NETWORKING
# KEYWORD: shutdown
#
# To enable subsonic, add this line to your /etc/rc.conf:
#
# subsonic_enable="YES"
#
# And optionally these line:
#
# subsonic_user="username" # Default is "root"
# subsonic_bin="/path/to/subsonic.sh" # Default is "/home/sonic/subsonic/standalone/subsonic.sh"

. /etc/rc.subr

name="subsonic"
rcvar="subsonic_enable"

load_rc_config $name

required_files=$subsonic_bin

: ${subsonic_enable="NO"}
: ${subsonic_user="root"}
: ${subsonic_bin="/home/sonic/subsonic/standalone/subsonic.sh"}

pidfile="/var/run/subsonic.pid"
command=$subsonic_bin

run_rc_command "$1"


However, the pidfile isn't created. I'm running the script as the user sonic and added him to wheel, because I thougth that he might not have sufficient permissions. I don't have any error in the subsonic.log, subsonic_sh.log, or any log file in /var/logs/ relating to this, so I can't give much more infos.
 
Last edited by a moderator:
Joined
Jan 7, 2015
Messages
1,155
Shot in the dark here, but what happens if you do..
touch /var/run/subsonic.pid && chown sonic:wheel /var/run/subsonic.pid

This will create that file, and own it to sonic.. Also you have the rc.d file running subsonic as root. Id keep the rc.d file happy and replace root with sonic, or alternatively do
sysrc subsonic_user=sonic but if you go this route do the below command first.. Keep things proper..

sysrc subsonic_enable=YES


Now does it run when you do service subsonic start ?

Edit: So I responded earlier without looking at the guide you used. That may be from the pre subsonic plugin days. Subsonic is up in the version 6's now, and FreeNAS is v9.10.2-U2. Is there a reason you are going this route? Why not use the prebuilt Subsonic PBI? If you are doing it just because, for fun, consider the awesome fork of Subsonic (actually 100% free) Libresonic; its basically identical to Subsonic, as it is based on Subsonic 6.
 
Last edited:

FlyingPersian

Patron
Joined
Jan 27, 2014
Messages
237
Hi John!

Thanks your your reply! I'll create the file later and check if it works. I was thinking on doing that as well, but I don't know whether FreeNAS checks for there to be a file named subsonic.pid or if it also looks at the content. Plus, the file should technically be delted when I stop subsonic, so then I'll have the problem again.

And yeah, the startup script isn't perfect. I didn't bother to change the user in that because, as you said, I added subsonic_user="sonic" into rc.conf.

The reason I'm not using plugins is, because I want to stay up to date as quickly as possbile, altbhough I have to note that subsonic isn't updated much anyway :p I was using madsonic for a while, but it costs 24€ for a year of premium and the chromcast support is crappy because at least on my install it keeps losing the connection. And I like subsonic because it's okay for 12€ a year, plus now it has working chromecast support as well! I'll check out Libresonic later tonight and report back.

Edit: Actually created the file really quick, didn't work! Libresonic also doesn't seem to support Chromecast, which is a dealbreaker :/
 
Last edited:
Joined
Jan 7, 2015
Messages
1,155
Fair enough my friend. Ive never done anysorts of chromecasting. How do you cast the streams? From a phone or something? I use an app called ultrasonic on an android and it works so slick, only over bluetooth to a receiver though. Im not sure if this might be any sort of option, if you cast the Ultrasonic app over. Not really sure how that works..

At any route go, good luck!
 

FlyingPersian

Patron
Joined
Jan 27, 2014
Messages
237
Hey
I found out that I can also install subsonic via pkg install subsonic-standalone. That incoporates everything I wanted, including the init script. And I can manually upgrade it when an update comes out on subsonic.org, because I can replace the install with the standalone files online.
Thanks for your help!
 
Last edited by a moderator:
Joined
Jan 7, 2015
Messages
1,155
You got it bud!
 
Status
Not open for further replies.
Top