Last active
October 9, 2019 01:32
-
-
Save Packet-Lost/19421deaa58df176901f6c35607560f4 to your computer and use it in GitHub Desktop.
EnsurePlex.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$plexstatus = (systemctl | grep plex) | Out-String | |
if($plexstatus.length -eq 0 ){ $startplex = $true } | |
try{ $plexfind = $plexstatus.trim().Split('loaded ')[1].Split(' ')[1]} | |
catch { $plexfind = $null } | |
if ($plexfind -ne 'running') { $startplex = $true } | |
if($startplex){ | |
systemctl start plexmediaserver.service | |
Add-Content /srv/logs/plexstart.log "$(Get-Date) Started plex." | |
} else { Write-Output 'Plex check completed, no need to start plex. Exiting.' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment