Skip to content

Commit

Permalink
.sh v2.0.0 (#9)
Browse files Browse the repository at this point in the history
Co-authored-by: zakary <[email protected]>
  • Loading branch information
bakerboy448 and zakkarry authored Apr 26, 2024
1 parent af296a5 commit b0fd592
Show file tree
Hide file tree
Showing 16 changed files with 376 additions and 317 deletions.
32 changes: 32 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .env
# Environment Configuration StarrScripts Sample 2024-04
# Rename this file to .env and fill in the values accordingly.
# Xseed
## Download Client Names
TORRENT_CLIENT_NAME="" # Example: "Qbit"
USENET_CLIENT_NAME="" # Example: "SABnzbd"
## Cross Seed API configuration
XSEED_HOST="" # Example: "crossseed"
XSEED_PORT="" # Example: "2468"
## API Key for Cross Seed, if applicable
XSEED_APIKEY="" # Example: "your-api-key"
## Path to store the script's database of prior searches
LOG_FILE="" # Example: "/config/xseed_db.log"
# ZFS Destory
VERBOSE=0
MAX_FREQ=2
MAX_HOURLY=2
MAX_DAILY=1
MAX_WEEKLY=0
MAX_MONTHLY=0
# Jdupes
JDUPES_OUTPUT_LOG="" # Example: "/.config/jdupes.log"
JDUPES_SOURCE_DIR="" # Example: "/mnt/data/media/"
JDUPES_DESTINATION_DIR="" # Example: "/mnt/data/torrents/"
JDUPES_HASH_DB="" # Example: "/.config/jdupes_hashdb"
# Qbittorrent Manage
QBIT_MANAGE_LOCK_FILE_PATH="" # Example: "/var/lock/qbm-qbit.lock"
QBIT_MANAGE_PATH="" # Example: "/opt/qbit-manage"
QBIT_MANAGE_VENV_PATH="" # Example: "/opt/qbit-manage/.venv"
QBIT_MANAGE_CONFIG_PATH="" # Example: "/opt/qbit-manage/config.yml"
QBIT_MANAGE_OPTIONS="" # Example: "-cs -re -cu -tu -ru -sl -r"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -348,3 +348,6 @@ MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
.ionide/

# Ignore .env
.env
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"hashdb",
"zfsburn"
]
}
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,42 @@

Misc Scripts for Starr and Related Apps

## dupe.sh

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.

## servarr/servarr_bot_merge.sh

Use to merge the latest changes from the Servarr Wiki Bot Branch for Prowlarr Indexers to Wiki Master.

## zfsburn.sh

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

## xseed.sh

Use with Starr On Import / On Upgrade custom script trigger to [Cross-Seed](https://github.com/cross-seed/cross-seed) search after import
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

## xseed-update.sh

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

## qbm-qbit.sh

Use with Qbit on download complete to trigger [QbitManage](https://github.com/StuffAnThings/qbit_manage) to run with the specified parameters
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.

## qbm-update.sh

Script to update [QbitManage](https://github.com/StuffAnThings/qbit_manage) to the currently checked out branch
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.

## pmm-update.sh

Script to update [Plex Meta Manager](https://github.com/meisnate12/Plex-Meta-Manager) to the currently checked out branch
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.

## pic-update.sh

Script to update [Plex-Image-Cleanup](https://github.com/meisnate12/Plex-Image-Cleanup) to the currently checked out branch
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.

## notifiarr-branch-builder.sh

Script to reinstall [Notifiarr](https://github.com/Notifiarr/notifiarr) from apt or build from source prompting for which branch to use
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.
34 changes: 24 additions & 10 deletions dupe.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
#!/bin/bash

jdupes_command="/usr/bin/jdupes"
exclude_dirs="-X nostr:.RecycleBin -X nostr:.trash"
include_ext="-X onlyext:mp4,mkv,avi"
output_log="/.config/jdupes.log"
source_dir="/mnt/data/media/"
destination_dir="/mnt/data/torrents/"
hash_db="/.config/jdupes_hashdb"
# Load environment variables from .env file
# Load environment variables from .env file if it exists
if [ -f ".env" ]; then
# shellcheck source=.env
source ".env"
fi
# Variables
JDUPES_OUTPUT_LOG=${JDUPES_OUTPUT_LOG:-"/var/log/jdupes.log"}
JDUPES_SOURCE_DIR=${JDUPES_SOURCE_DIR:-"/mnt/data/media/"}
JDUPES_DESTINATION_DIR=${JDUPES_DESTINATION_DIR:-"/mnt/data/torrents/"}
JDUPES_HASH_DB=${JDUPES_HASH_DB:-"/var/lib/jdupes_hashdb"}
## Secret Variables
JDUPES_COMMAND=${JDUPES_COMMAND:-"/usr/bin/jdupes"}
JDUPES_EXCLUDE_DIRS=${JDUPES_EXCLUDE_DIRS:-"-X nostr:.RecycleBin -X nostr:.trash"}
JDUPES_INCLUDE_EXT=${JDUPES_INCLUDE_EXT:-"mp4,mkv,avi"}

# Logging the start of the operation
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
echo "[$timestamp] Duplicate search started for $source_dir and $destination_dir." >> "$output_log"
$jdupes_command $exclude_dirs $include_ext -L -r -Z -y "$hash_db" "$source_dir" "$destination_dir" >> "$output_log"
echo "[$timestamp] Duplicate search started for $JDUPES_SOURCE_DIR and $JDUPES_DESTINATION_DIR." >>"$JDUPES_OUTPUT_LOG"
echo "command is"
# Running jdupes with the loaded environment variables
echo "$JDUPES_COMMAND" "$JDUPES_EXCLUDE_DIRS" "$JDUPES_INCLUDE_EXT" -L -r -Z -y "$JDUPES_HASH_DB" "$JDUPES_SOURCE_DIR" "$JDUPES_DESTINATION_DIR"
"$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"

# Logging the completion of the operation
timestamp=$(date +"%Y-%m-%d %H:%M:%S")
echo "[$timestamp] Duplicate search completed for $source_dir and $destination_dir." >> "$output_log"
echo "[$timestamp] Duplicate search completed for $JDUPES_SOURCE_DIR and $JDUPES_DESTINATION_DIR." >>"$JDUPES_OUTPUT_LOG"
18 changes: 9 additions & 9 deletions f2b-dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@ temp_file=$(mktemp)

# Function to add content to the temporary file
add_content() {
echo -e "\n$1\n" >> "$temp_file"
cat "$2" >> "$temp_file" 2>/dev/null
echo -e "\n" >> "$temp_file"
echo -e "\n$1\n" >>"$temp_file"
cat "$2" >>"$temp_file" 2>/dev/null
echo -e "\n" >>"$temp_file"
}

# List all active jails
echo "Listing all active jails:" >> "$temp_file"
fail2ban-client status >> "$temp_file"
echo "Listing all active jails:" >>"$temp_file"
fail2ban-client status >>"$temp_file"

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

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

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

# Upload to termbin
echo "Uploading to Termbin..." >> "$temp_file"
echo "Uploading to Termbin..." >>"$temp_file"
cat "$temp_file" | nc termbin.com 9999

# Cleanup
Expand Down
32 changes: 0 additions & 32 deletions misc/flaresolverr-linux.sh

This file was deleted.

Loading

0 comments on commit b0fd592

Please sign in to comment.