Jump to content

CentOS Installation - PID file Location ?


ViolentVotan
Go to solution Solved by jose,

Recommended Posts

ViolentVotan

Hello,

 

Using the generic installation insctructions for MediaBrowserServer from the Download page, where is the PID file located? I couldnt find any mediabrowser.pid or MediaBrowserServer.pid.

 

If none is created by default, what can I put in the /etc/opt/MediaBrowser/MediaBrowserServer/MediaBrowserServer.cfg as mine seems to be empty?

Link to comment
Share on other sites

ViolentVotan

I do create a pid file for the init.d centos 6.6 but for systemd service there is no pidfile

 

Aww :( Because I use monit to automatically keep an eye on all my services and restart them if necessary, then I have to use matching strings instead of a pid file.

Edited by ViolentVotan
Link to comment
Share on other sites

From what i understand with systemd services you dont use pid unless you are forking or something like that. this is the first rpm package i have made so if you have any ideas on how to add one with systemd i will try and inplement it.

Link to comment
Share on other sites

As a quick fix edit start.sh, this should create a pid file on the data folder that the server has write rights 

#! /bin/sh
umask 002

HOME="$(getent passwd $USER | awk -F ':' '{print $6}')"
conf_file_path="MediaBrowser/MediaBrowserServer/MediaBrowserServer.cfg"
program_data_path="/var/opt/MediaBrowser/MediaBrowserServer"                                
program_path="/opt/MediaBrowser/MediaBrowserServer/bin"
FFmpeg="/bin/ffmpeg"
FFprobe="/bin/ffprobe"

if [ -r /etc/opt/$conf_file_path ]; then
    echo "Reading system-wide config...." >&2
    . /etc/opt/$conf_file_path
fi
if [ -r ~/.$conf_file_path ]; then
    echo "Reading user config...." >&2
    . ~/.$conf_file_path
fi

cd "$program_path"
. ../helpers/check_mono.sh
cd "$program_path"
ifFFmpeg=""
if [[ -x $FFmpeg ]]; then ifFFmpeg="-ffmpeg $FFmpeg"; fi;
ifFFprobe=""
if [[ -x $FFprobe ]]; then ifFFprobe="-ffprobe $FFprobe"; fi;
mkdir -p $program_data_path
echo $$ > $program_data_path/MediaBrowserServer.pid 
exec $mono_path/bin/mono MediaBrowser.Server.Mono.exe -programdata "$program_data_path" $ifFFmpeg $ifFFprobe

The only things is it wont delete the file, some code would need to be put on the service file to remove the pid on a normal stop.

Edited by jose
Link to comment
Share on other sites

  • Solution

New packages being build should create a .pid file at $program_data_path/.MediaBrowserServer/MediaBrowserServer.pid

  • Like 1
Link to comment
Share on other sites

ViolentVotan

New packages being build should create a .pid file at $program_data_path/.MediaBrowserServer/MediaBrowserServer.pid

 

Works, thank you!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...