Add start-calibre-server.ps1

This commit is contained in:
Markus Fleschutz
2021-07-16 16:49:42 +02:00
parent 47f084b2d4
commit 476108bcbc
4 changed files with 30 additions and 12 deletions

View File

@ -1,12 +0,0 @@
#!/bin/sh
# Syntax: ./calibre-server
# Description: starts a Calibre server
# Author: Markus Fleschutz
# Source: github.com/fleschutz/PowerShell
# License: CC0
echo "Starting Calibre Server ..."
calibre-server --port 8099 --num-per-page 100 --userdb $HOME/CalibreUsers.sqlite --log $HOME/CalibreServer.log --daemonize $HOME/'Calibre Library'
echo "OK - Calibre Server started."
exit 0

View File

@ -0,0 +1,28 @@
<#
.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
Author: Markus Fleschutz / License: CC0
#>
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
}