I have long used PS3MediaServer as daemon on my Ubuntu headless systems (from 10.04 to 11.10).
Recently I installed the program with deb package (thanks happy.neko) without any problem.
However I noticed that the start/stop procedure uses a very obsolete init script and new requirements from users may not be met.
Starting from the "skeleton initscript" of Debian as template, I therefore decided to fully rewrite the procedure to meet my requirements and those of other forum users.
The new procedure is suitable for both "deb package" and "traditional package" versions.
The difficult part was adapting procedure to java process management of PS3 Media Server, while sticking to the LSB standard and its related return codes.
The new init procedure has the following features and advantages:
- a very clear and simple structure of the two files (initscript and default);
- its full compatibility with the LSB standard (both Debian, Ubuntu and derivates);
- full PIDFILE support;
- the presence of the PIDFILE allows to identify the correct java daemon process of PS3 Media Server in order to avoid confusion with other instances of same program started from the GUI;
- full support of LSB "log_*" message functions;
- full support for the "start-stop-daemon" procedure (both in the start and stop of the daemon);
- high reliability in case of crash of java processes of PS3 Media Server.
- management and correct use of the "PMS_PROFILE" environment variable – this is read by PS3 Media Server when it starts (variable "P3MS_PROFILE" in the old initscript was wrong);
- shift of all PS3 Media Servers specific variables to "/etc/default/ps3mediaserver" file with full detailed instructions;
- opportunity to run the daemon with a different user in only three simple steps (described in file "/etc/default/ps3mediaserver");
- in accordance with the Debian standard, configuration files of daemons necessarily need to be placed in /etc subfolder. So in the new procedure files of system profile ("PMS.conf" and WEB.conf") are now read as default directly from folder "/etc/ps3mediaserver" (that is suitables for happy.neko deb package);
- Variables values are based on files structure of happy.neko deb package. If user want change location (e.g. "/opt/ps3mediaserver" - to use the initscript with downloaded linux package from PS3MS web site), it has to change only three variables: "PMS_PROFILE" variable in "/etc/default/ps3mediaserver" file; "NAME" and "DAEMON" variables in "/etc/init.d/ps3mediaserver" file; if you change the variable "NAME" please be careful to rename "/etc/default/ps3mediaserver" file also;
- for headless mode (daemon need this) now it uses "JAVA_OPT" variable with value "-Djava.awt.headless=true" that, based on my experience, in presence of some particular graphical environment, is more reliable than "DAEMON_OPTS" variable with value "console".
For one month or so, I have been testing this procedure on my Ubuntu 11.10 (64bit) headless system in all possible instances (start, stop, status, restart, "restart" in case of daemon crash, "stop" in case of running a multimedia stream) without any problem having been found.
It would be necessary to test the procedure on other systems: Debian 6, older and new (12.04) versions of Ubuntu and some derivates.
As my personal contribution to forum, please find attached in "ps3ms_init.zip" the two files I rewrote entirely:
- "ps3mediaserver.init" to be renamed as "/etc/init.d/ps3mediaserver";
- "ps3mediaserver.default" to be renamed as "/etc/default/ps3mediaserver".
I hope that my work will be instrumental in the improvement of PS3 Media Server project.
Waiting for your test results and opinions
- (2.56 KiB) Downloaded 567 times