Skip to content

Commit b0fd592

Browse files
.sh v2.0.0 (#9)
Co-authored-by: zakary <zak@ary.dev>
1 parent af296a5 commit b0fd592

16 files changed

+376
-317
lines changed

.env.sample

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .env
2+
# Environment Configuration StarrScripts Sample 2024-04
3+
# Rename this file to .env and fill in the values accordingly.
4+
# Xseed
5+
## Download Client Names
6+
TORRENT_CLIENT_NAME="" # Example: "Qbit"
7+
USENET_CLIENT_NAME="" # Example: "SABnzbd"
8+
## Cross Seed API configuration
9+
XSEED_HOST="" # Example: "crossseed"
10+
XSEED_PORT="" # Example: "2468"
11+
## API Key for Cross Seed, if applicable
12+
XSEED_APIKEY="" # Example: "your-api-key"
13+
## Path to store the script's database of prior searches
14+
LOG_FILE="" # Example: "/config/xseed_db.log"
15+
# ZFS Destory
16+
VERBOSE=0
17+
MAX_FREQ=2
18+
MAX_HOURLY=2
19+
MAX_DAILY=1
20+
MAX_WEEKLY=0
21+
MAX_MONTHLY=0
22+
# Jdupes
23+
JDUPES_OUTPUT_LOG="" # Example: "/.config/jdupes.log"
24+
JDUPES_SOURCE_DIR="" # Example: "/mnt/data/media/"
25+
JDUPES_DESTINATION_DIR="" # Example: "/mnt/data/torrents/"
26+
JDUPES_HASH_DB="" # Example: "/.config/jdupes_hashdb"
27+
# Qbittorrent Manage
28+
QBIT_MANAGE_LOCK_FILE_PATH="" # Example: "/var/lock/qbm-qbit.lock"
29+
QBIT_MANAGE_PATH="" # Example: "/opt/qbit-manage"
30+
QBIT_MANAGE_VENV_PATH="" # Example: "/opt/qbit-manage/.venv"
31+
QBIT_MANAGE_CONFIG_PATH="" # Example: "/opt/qbit-manage/config.yml"
32+
QBIT_MANAGE_OPTIONS="" # Example: "-cs -re -cu -tu -ru -sl -r"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,6 @@ MigrationBackup/
348348

349349
# Ionide (cross platform F# VS Code tools) working folder
350350
.ionide/
351+
352+
# Ignore .env
353+
.env

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"cSpell.words": [
3+
"hashdb",
4+
"zfsburn"
5+
]
6+
}

README.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,42 @@
22

33
Misc Scripts for Starr and Related Apps
44

5+
## dupe.sh
6+
7+
Run jdupes on the specified path and output the results to a file. Copy .env.sample to .env and fill in the required values under "# Jdupes" Header. Review the parameters in the script to ensure they match your use case.
8+
9+
## servarr/servarr_bot_merge.sh
10+
11+
Use to merge the latest changes from the Servarr Wiki Bot Branch for Prowlarr Indexers to Wiki Master.
12+
13+
## zfsburn.sh
14+
15+
Use to cleanup (delete) zfs autosnaphots older than the specified number of days. Copy .env.sample to .env and fill in the required values. Copy .env.sample to .env and fill in the required values under "# ZFS Destory" Header
16+
517
## xseed.sh
618

7-
Use with Starr On Import / On Upgrade custom script trigger to [Cross-Seed](https://github.com/cross-seed/cross-seed) search after import
19+
Use with Starr On Import / On Upgrade custom script trigger to [Cross-Seed](https://github.com/cross-seed/cross-seed) search after import. Copy .env.sample to .env and fill in the required values under "# Xseed" Header
820

921
## xseed-update.sh
1022

1123
Script to update [Cross-Seed](https://github.com/cross-seed/cross-seed) to the current version
1224

1325
## qbm-qbit.sh
1426

15-
Use with Qbit on download complete to trigger [QbitManage](https://github.com/StuffAnThings/qbit_manage) to run with the specified parameters
27+
Use with Qbit on download complete to trigger [QbitManage](https://github.com/StuffAnThings/qbit_manage) to run with the specified parameters. Copy .env.sample to .env and fill in the required values under "# Qbittorrent Manage" Header.
1628

1729
## qbm-update.sh
1830

19-
Script to update [QbitManage](https://github.com/StuffAnThings/qbit_manage) to the currently checked out branch
31+
Script to update [QbitManage](https://github.com/StuffAnThings/qbit_manage) to the currently checked out branch. Review the parameters in the script to ensure they match your setup.
2032

2133
## pmm-update.sh
2234

23-
Script to update [Plex Meta Manager](https://github.com/meisnate12/Plex-Meta-Manager) to the currently checked out branch
35+
Script to update [Plex Meta Manager](https://github.com/meisnate12/Plex-Meta-Manager) to the currently checked out branch. Review the parameters in the script to ensure they match your setup.
2436

2537
## pic-update.sh
2638

27-
Script to update [Plex-Image-Cleanup](https://github.com/meisnate12/Plex-Image-Cleanup) to the currently checked out branch
39+
Script to update [Plex-Image-Cleanup](https://github.com/meisnate12/Plex-Image-Cleanup) to the currently checked out branch. Review the parameters in the script to ensure they match your setup.
2840

2941
## notifiarr-branch-builder.sh
3042

31-
Script to reinstall [Notifiarr](https://github.com/Notifiarr/notifiarr) from apt or build from source prompting for which branch to use
43+
Script to reinstall [Notifiarr](https://github.com/Notifiarr/notifiarr) from apt or build from source prompting for which branch to use. Review the parameters in the script to ensure they match your setup.

dupe.sh

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
#!/bin/bash
22

3-
jdupes_command="/usr/bin/jdupes"
4-
exclude_dirs="-X nostr:.RecycleBin -X nostr:.trash"
5-
include_ext="-X onlyext:mp4,mkv,avi"
6-
output_log="/.config/jdupes.log"
7-
source_dir="/mnt/data/media/"
8-
destination_dir="/mnt/data/torrents/"
9-
hash_db="/.config/jdupes_hashdb"
3+
# Load environment variables from .env file
4+
# Load environment variables from .env file if it exists
5+
if [ -f ".env" ]; then
6+
# shellcheck source=.env
7+
source ".env"
8+
fi
9+
# Variables
10+
JDUPES_OUTPUT_LOG=${JDUPES_OUTPUT_LOG:-"/var/log/jdupes.log"}
11+
JDUPES_SOURCE_DIR=${JDUPES_SOURCE_DIR:-"/mnt/data/media/"}
12+
JDUPES_DESTINATION_DIR=${JDUPES_DESTINATION_DIR:-"/mnt/data/torrents/"}
13+
JDUPES_HASH_DB=${JDUPES_HASH_DB:-"/var/lib/jdupes_hashdb"}
14+
## Secret Variables
15+
JDUPES_COMMAND=${JDUPES_COMMAND:-"/usr/bin/jdupes"}
16+
JDUPES_EXCLUDE_DIRS=${JDUPES_EXCLUDE_DIRS:-"-X nostr:.RecycleBin -X nostr:.trash"}
17+
JDUPES_INCLUDE_EXT=${JDUPES_INCLUDE_EXT:-"mp4,mkv,avi"}
1018

19+
# Logging the start of the operation
1120
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
12-
echo "[$timestamp] Duplicate search started for $source_dir and $destination_dir." >> "$output_log"
13-
$jdupes_command $exclude_dirs $include_ext -L -r -Z -y "$hash_db" "$source_dir" "$destination_dir" >> "$output_log"
21+
echo "[$timestamp] Duplicate search started for $JDUPES_SOURCE_DIR and $JDUPES_DESTINATION_DIR." >>"$JDUPES_OUTPUT_LOG"
22+
echo "command is"
23+
# Running jdupes with the loaded environment variables
24+
echo "$JDUPES_COMMAND" "$JDUPES_EXCLUDE_DIRS" "$JDUPES_INCLUDE_EXT" -L -r -Z -y "$JDUPES_HASH_DB" "$JDUPES_SOURCE_DIR" "$JDUPES_DESTINATION_DIR"
25+
"$JDUPES_COMMAND" "$JDUPES_EXCLUDE_DIRS" -X onlyext:"$JDUPES_INCLUDE_EXT" -L -r -Z -y "$JDUPES_HASH_DB" "$JDUPES_SOURCE_DIR" "$JDUPES_DESTINATION_DIR" >>"$JDUPES_OUTPUT_LOG"
26+
27+
# Logging the completion of the operation
1428
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
15-
echo "[$timestamp] Duplicate search completed for $source_dir and $destination_dir." >> "$output_log"
29+
echo "[$timestamp] Duplicate search completed for $JDUPES_SOURCE_DIR and $JDUPES_DESTINATION_DIR." >>"$JDUPES_OUTPUT_LOG"

f2b-dump.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,35 @@ temp_file=$(mktemp)
55

66
# Function to add content to the temporary file
77
add_content() {
8-
echo -e "\n$1\n" >> "$temp_file"
9-
cat "$2" >> "$temp_file" 2>/dev/null
10-
echo -e "\n" >> "$temp_file"
8+
echo -e "\n$1\n" >>"$temp_file"
9+
cat "$2" >>"$temp_file" 2>/dev/null
10+
echo -e "\n" >>"$temp_file"
1111
}
1212

1313
# List all active jails
14-
echo "Listing all active jails:" >> "$temp_file"
15-
fail2ban-client status >> "$temp_file"
14+
echo "Listing all active jails:" >>"$temp_file"
15+
fail2ban-client status >>"$temp_file"
1616

1717
# Get status for each jail
1818
jails=$(fail2ban-client status | grep 'Jail list:' | sed -E 's/^[^:]+:\s+//;s/,//g')
1919
for jail in $jails; do
20-
echo -e "\nStatus of $jail jail:\n" >> "$temp_file"
21-
fail2ban-client status "$jail" >> "$temp_file"
20+
echo -e "\nStatus of $jail jail:\n" >>"$temp_file"
21+
fail2ban-client status "$jail" >>"$temp_file"
2222
done
2323

2424
# Global configurations
2525
add_content "Global Fail2Ban Configuration (/etc/fail2ban/jail.conf):" "/etc/fail2ban/jail.conf"
2626
add_content "Custom Global Configuration (/etc/fail2ban/jail.local):" "/etc/fail2ban/jail.local"
2727

2828
# Custom jail configurations in jail.d/
29-
echo "Custom Jail Configurations in /etc/fail2ban/jail.d/:" >> "$temp_file"
29+
echo "Custom Jail Configurations in /etc/fail2ban/jail.d/:" >>"$temp_file"
3030
for config_file in /etc/fail2ban/jail.d/*; do
3131
[ -e "$config_file" ] || continue
3232
add_content "Custom Jail Configuration ($config_file):" "$config_file"
3333
done
3434

3535
# Upload to termbin
36-
echo "Uploading to Termbin..." >> "$temp_file"
36+
echo "Uploading to Termbin..." >>"$temp_file"
3737
cat "$temp_file" | nc termbin.com 9999
3838

3939
# Cleanup

misc/flaresolverr-linux.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)