PowerShell/Scripts/start-calibre-server.ps1

30 lines
832 B
PowerShell
Raw Normal View History

2021-08-26 10:46:12 +02:00
<#
2021-07-16 16:49:42 +02:00
.SYNOPSIS
start-calibre-server.ps1
.DESCRIPTION
Starts a local Calibre server as a daemon process
.EXAMPLE
PS> .\start-calibre-server.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
2021-08-03 15:53:57 +02:00
Author: Markus Fleschutz
License: CC0
2021-07-16 16:49:42 +02:00
#>
try {
$StopWatch = [system.diagnostics.stopwatch]::startNew()
$Result = (calibre-server --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'calibre-server' - make sure Calibre is installed and available" }
& calibre-server --port 8099 --num-per-page 100 --userdb $HOME/CalibreUsers.sqlite --log $HOME/CalibreServer.log --daemonize $HOME/'Calibre Library'
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
"✔️ started Calibre Server in $Elapsed sec"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}