mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-25 17:33:17 +01:00
Update start-calibre-server.ps1
This commit is contained in:
parent
6a0a372cd5
commit
c8820b0e9e
@ -1,8 +1,8 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
start-calibre-server.ps1
|
start-calibre-server.ps1 [<port>]
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
Starts a local Calibre server as a daemon process.
|
Starts a local Calibre server as background process (Web port number is 8099 by default).
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> .\start-calibre-server.ps1
|
PS> .\start-calibre-server.ps1
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -11,16 +11,20 @@
|
|||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
#>
|
#>
|
||||||
|
|
||||||
|
param([int]port = 8099)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
$StopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
$Result = (calibre-server --version)
|
"Step 1/2: Searching for Calibre Server executable..."
|
||||||
|
& calibre-server --version
|
||||||
if ($lastExitCode -ne "0") { throw "Can't execute 'calibre-server' - make sure Calibre is installed and available" }
|
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'
|
"Step 2/2: Starting Calibre Server as background process..."
|
||||||
|
& calibre-server --port $port --num-per-page 100 --userdb $HOME/CalibreUsers.sqlite --log $HOME/CalibreServer.log --daemonize $HOME/'Calibre Library'
|
||||||
|
|
||||||
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ started Calibre Server in $Elapsed sec"
|
"✔️ started Calibre Server with port $port in $Elapsed sec"
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
"⚠️ Error: $($Error[0]) ($($MyInvocation.MyCommand.Name):$($_.InvocationInfo.ScriptLineNumber))"
|
||||||
|
Loading…
Reference in New Issue
Block a user