how can i create a systemd unit file to stop plex? i believe there are 3 services that are started as far as i can tell from ps:
plex 12377 0.3 1.2 670688 104844 ? Ssl Nov21 41:13 /opt/plexmediaserver/Plex Media Server
plex 12437 0.2 0.6 339016 55220 ? Sl Nov21 34:22 /opt/plexmediaserver/Plex DLNA Server
plex 12440 0.0 0.1 514192 11904 ? Sl Nov21 8:09 /opt/plexmediaserver/Plex Tuner Service
the unit file only has /opt/plexmediaserver/Plex\x20Media\x20Server for the ExecStart option. does this file start all services? which command do i need to run manually to stop plex? i want to create a service file to stop plex before shutting down my server.
PMS itself launches all subprocesses.
When PMS receives the termination signal (systemctl stop plexmediaserver) it catches the signal and terminates all subprocesses and exit.
Please use /etc/systemd/system/plexmediaserver.service.d/override.conf to customize your configuration. I overwrite /lib/systemd/system/plexmediaserver.service with each package install. Anything you do there will be lost.
You are free to customize the systemdEnvironment= statements, as well as User= and Group=, and place those overrides in the override.conf
You may also override the default UMask.
when you say PMS, do you mean the following executable “/opt/plexmediaserver/Plex Media Server”? and if so, is this the process looking out for termination signals ( kill -9 )? on distros without systemd it says to use service plexmediaserver stop,stop. do you know what the full path of plexmediaserver is? is that the “/opt/plexmediaserver/Plex Media Server”?
im using arch x64. so my thought process was to create a service file that would run the actual pms executable (not sure where this is located, i though it might be “/opt/plexmediaserver/Plex Media Server”) with the stop option. for example “/opt/plexmediaserver/Plex Media Server stop”. but it looks like it might be easier to just make a service file that runs systemctl stop plexmediaserver. the reason i wanted to do this is because i rebooted my plex server twice without stopping the plex service and my storage disk got corrupt. i could not read any data from it. if i stop plex before shutting down and unmount my storage disk, my disk is ok. im going to include this also on my service file but i can do that. its the plex part that im not sure of. im new to plex so dont have much experience with it.
im getting “/opt/plexmediaserver/Plex Media Server” from the /usr/lib/systemd/system/plexmediaserver.service file from the ExecStart= option.
The service file will tell you where it’s located (the ExecStart= line)
The issue with your disk storage getting corrupted because the OS didn’t terminate and flush buffers is not something I can help with . That is a fundamental, and serious, problem with the OS.
Regarding Aarch as a distro, it’s not supported in any way. One of the reasons is because of the corruption issue you just cited.
thats why i want to stop the plex service prior to reboot. i just need to know which command to run to stop it. if i do systemctl stop plexmediaserver, its like im blindly stopping the service. do you know which command/xecutable is the correct one to stop plex? aka “/opt/plexmediaserver/Plex Media Server” with option stop,start etc…?
why or why not systemd does not stop plexmediaserver.service is beyond my control/scope of knowledge, but this service file works for me.
do you mount your storage disk via fstab? i am thinking about adding a requires option to the plexmediaserver.service file to ensure the storage drive is mounted prior to starting plex. the only thing i noticed if the storage disk is not mounted is that plex spits out an error about media not being available. i rather not start it if the storage disk is not mounted.
If you wish to override (/etc/systemd/system/plexmediaserver.service.d/override.conf) the service parameters, be advised all maintenance of that file would be your responsibility should changes to /usr/lib/systemd/system/plexmediaserver.service be required as each update / upgrade overwrites the existing master service definition and always will.