# Plex Management Script Documentation This document provides an overview and step-by-step explanation of the `plex.sh` script. This script is used to manage the Plex Media Server service on a systemd-based Linux distribution. ## Script Overview The script performs the following main tasks: 1. Starts the Plex Media Server. 2. Stops the Plex Media Server. 3. Restarts the Plex Media Server. 4. Displays the current status of the Plex Media Server. ## Detailed Steps ### 1. Start Plex Media Server ```bash start_plex() { sudo systemctl start plexmediaserver echo "Plex Media Server started." } ``` This function starts the Plex Media Server using `systemctl`. ### 2. Stop Plex Media Server ```bash stop_plex() { sudo systemctl stop plexmediaserver echo "Plex Media Server stopped." } ``` This function stops the Plex Media Server using `systemctl`. ### 3. Restart Plex Media Server ```bash restart_plex() { sudo systemctl restart plexmediaserver echo "Plex Media Server restarted." } ``` This function restarts the Plex Media Server using `systemctl`. ### 4. Display Plex Media Server Status ```bash status_plex() { sudo systemctl status plexmediaserver } ``` This function displays the current status of the Plex Media Server using `systemctl`. ## Usage To use the script, run it with one of the following parameters: ```shell ./plex.sh {start|stop|restart|status} ``` - `start`: Starts the Plex Media Server. - `stop`: Stops the Plex Media Server. - `restart`: Restarts the Plex Media Server. - `status`: Displays the current status of the Plex Media Server. ## Important Information - Ensure that the script is executable. You can make it executable with the following command: ```shell chmod +x plex.sh ``` - The script uses `systemctl` to manage the Plex Media Server service. Ensure that `systemctl` is available on your system. - The script requires `sudo` privileges to manage the Plex Media Server service. Ensure that you have the necessary permissions to run the script with `sudo`. By following this documentation, you should be able to understand and use the `plex.sh` script effectively.