Skip to content

Instantly share code, notes, and snippets.

@Packet-Lost
Last active October 9, 2019 01:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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