Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
EnsurePlex.ps1
$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
You can’t perform that action at this time.