mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-12 19:14:33 +01:00
29 lines
848 B
PowerShell
Executable File
29 lines
848 B
PowerShell
Executable File
<#
|
|
.SYNOPSIS
|
|
start-calibre-server.ps1
|
|
.DESCRIPTION
|
|
Starts a local Calibre server as a daemon process.
|
|
.EXAMPLE
|
|
PS> .\start-calibre-server.ps1
|
|
.NOTES
|
|
Author: Markus Fleschutz · License: CC0
|
|
.LINK
|
|
https://github.com/fleschutz/PowerShell
|
|
#>
|
|
|
|
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 {
|
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
|
exit 1
|
|
}
|