things
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
hbbs:
|
||||
image: rustdesk/rustdesk-server:1.1.11
|
||||
container_name: rustdesk-hbbs
|
||||
command: hbbs -r ${RUSTDESK_DOMAIN}:21117
|
||||
volumes:
|
||||
- ./data/hbbs:/root
|
||||
ports:
|
||||
- "21115:21115"
|
||||
- "21116:21116"
|
||||
- "21116:21116/udp"
|
||||
- "21118:21118"
|
||||
restart: unless-stopped
|
||||
|
||||
hbbr:
|
||||
image: rustdesk/rustdesk-server:1.1.11
|
||||
container_name: rustdesk-hbbr
|
||||
command: hbbr
|
||||
volumes:
|
||||
- ./data/hbbr:/root
|
||||
ports:
|
||||
- "21117:21117"
|
||||
- "21119:21119"
|
||||
depends_on:
|
||||
- hbbs
|
||||
restart: unless-stopped
|
||||
@@ -0,0 +1,68 @@
|
||||
# Set up your TrueNAS server details and API Key
|
||||
$TrueNASSource = "https://truenas3.kwyjibo.info"
|
||||
$APIKeySource = "1-JLgbBRp1c0xRlAi5237SFeb7LZnLT23k4K8u95ewqgvTDO8jauv5r6s2MIPH7GmW" # Replace with your actual API key
|
||||
|
||||
# Construct the full API URL
|
||||
$TrueNASSourceUrl = "$TrueNASSource$Endpoint"
|
||||
|
||||
# Set up the headers with the API Key for authentication
|
||||
$headers = @{
|
||||
"Authorization" = "Bearer $APIKeySource"
|
||||
"Content-Type" = "application/json"
|
||||
}
|
||||
|
||||
$Endpoint = "/api/v2.0/zfs/snapshot"
|
||||
$TrueNASSourceUrl = "$TrueNASSource$Endpoint"
|
||||
$SnapshotSplat = @{
|
||||
Uri = $TrueNASSourceUrl
|
||||
Headers = $headers
|
||||
Method = "Get"
|
||||
SkipCertificateCheck = $true
|
||||
}
|
||||
$Snapshots = Invoke-RestMethod @SnapshotSplat
|
||||
|
||||
|
||||
# report on snapshot sizes
|
||||
$Report =
|
||||
$Snapshots |
|
||||
ForEach-Object {
|
||||
[PSCustomObject]@{
|
||||
Dataset = $_.dataset
|
||||
|
||||
UsedGB = [math]::Round(
|
||||
[int64]$_.properties.logicalreferenced.rawvalue / 1GB, 2
|
||||
)
|
||||
|
||||
Creation = [DateTimeOffset]::FromUnixTimeSeconds(
|
||||
[int64]$_.properties.creation.rawvalue
|
||||
).LocalDateTime
|
||||
}
|
||||
} |
|
||||
Group-Object Dataset | ForEach-Object {
|
||||
$snaps = $_.Group | Sort-Object Creation
|
||||
$newest = $snaps[-1]
|
||||
|
||||
[PSCustomObject]@{
|
||||
Dataset = $_.Name
|
||||
|
||||
NewestSnapshotDate = $newest.Creation
|
||||
NewestSnapshotGB = $newest.UsedGB
|
||||
|
||||
SmallestSnapshotGB = ($snaps | Measure-Object UsedGB -Minimum).Minimum
|
||||
LargestSnapshotGB = ($snaps | Measure-Object UsedGB -Maximum).Maximum
|
||||
|
||||
SnapshotCount = $snaps.Count
|
||||
SnapshotOverhead = ($snaps | Measure-Object UsedGB -Maximum).Maximum - $newest.UsedGB
|
||||
}
|
||||
}
|
||||
|
||||
$Report | Where-Object { $_.Dataset -NotLike "*boot*" -and $_.Dataset -notlike "*apps*" } | Format-Table -AutoSize
|
||||
|
||||
$Report | Where-Object { $_.Dataset -Like "*Delta*" } | Measure-Object -Property SnapshotOverhead -Sum
|
||||
|
||||
$DatasetRoots = @($Report | ForEach-Object { $_.Dataset.split('/')[0] } | Where-Object { $_ -notlike "*boot*" -and $_ -notlike "*nvme*" -and $_ -notlike "*Sidewinder*" } | Select-Object -Unique )
|
||||
|
||||
$DatasetRoots | ForEach-Object {
|
||||
$_;
|
||||
$Report | Where-Object { $_.Dataset -like "*$_*" }
|
||||
}
|
||||
@@ -51,10 +51,11 @@ function Download-YTDLP {
|
||||
}
|
||||
|
||||
# 1. Execute yt-dlp using the call operator (&) and passing the arguments array (@)
|
||||
& $ytDlpPath $arguments
|
||||
$output = & $ytDlpPath @arguments 2>&1
|
||||
$exitCode = $LASTEXITCODE
|
||||
|
||||
# 2. CRITICAL: Check the Exit Code immediately after execution
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
if ($exitCode -ne 0) {
|
||||
# If the exit code is not 0, we throw a terminating exception.
|
||||
# This exception will be caught by your external try/catch block!
|
||||
$ErrorMessage = "yt-dlp failed (Exit Code: $($LASTEXITCODE)). Check standard error output for details."
|
||||
|
||||
Reference in New Issue
Block a user