Skip to content

sicXnull/homelab-scripts

Repository files navigation

Homelab Scripts w/Discord Embeds

Various scripts I use to maintain my homelab. Sends notifications to Discord

Scripts

apt-upgrade.py - Pretty straight forward. Runs apt-get update & upgrade. Sends notification when complete

  • change webhook_url & pytz.timezone as needed

image

rsync.py - Runs rsync command. ignores the various filetypes that cause errors. Sends notification when complete

  • change webhook_url source_dirs target_dir & pytz.timezone

rsync-ssh.py - Runs rsync command - Syncs to remote machine via SSH ignores the various filetypes that cause errors. Sends notification when complete

  • change private_key webhook_url source_dirs target_dir & pytz.timezone

image

certbot-renewal.py - Checks expiration date of certificate. Notifies when renewed

  • change webhook_url subdomain & base_domain (TO DO: Notify if cert expires, renew)

image

plex-update.py - checks current Plex version and updates if needed. Notifies when updated

  • change webhook_url

image

plex-backup.py - backs up plex db & data

  • change webhook_url

  • change backup_dir

image

pfbak.py - creates pfSense backup and notified when complete

  • change .env file

image

vaultwarden.py - Modified version of an existing VaultWarden backup script. Added ability to save to samba share and send notifications. The existing VaultWarden DB is encrypted but still stores sensitive data in cleartext such as email address, password hint and websites. This encrypts the archive to add another layer of protection.

vaultwarden-ssh.py - Same as above, sends to remote machine via SSH instead. Change remote_host , remote_username, remote_path as well as everything below

  • change webhook_url
  • create .secrets folder if it does not already exist sudo mkdir /root/.secrets
  • add the following to warden.ini sudo nano /root/.secrets/warden.ini
[Vaultwarden]
password = YOUR_PASSWORD_HERE
  • Set permissions so only root has access
sudo chmod 700 /root/.secrets
sudo chmod 600 /root/.secrets/warden.ini
sudo chown -R root:root /root/.secrets

image

snapraid.py - fork of snapraid-runner

  • change webhook_url in snapraid-runner.conf. otherwise follow same configuration.

image

Deployment

Add to crontab. Example:

  • rsync Daily @ 10pm
0 22 * * * python3 /opt/homelab-scripts/rsync.py
  • SnapRaid Daily @ 1am
0 1 * * * python3 /opt/homelab-scripts/snapraid/snapraid.py -c /opt/homelab-scripts/snapraid/snapraid-runner.conf
  • pfSense Sundays @ 8am
0 8 * * 0 python3 /opt/homelab-scripts/pfsense/pfbak.py
  • Vaultwarden Sundays @ 8:05am
5 8 * * 0 python3 /opt/homelab-scripts/pfsense/vaultwarden.py
  • apt-upgrade Sundays @ 9am
0 9 * * 0 python3 /opt/homelab-scripts/apt-upgrade.py
  • Plex update Daily @ 4am
0 4 * * * python3 /opt/homelab-scripts/plex-update.py
  • certbot renewal every 6 hours
0 */6 * * * python3 /opt/homelab-scripts/certbot-renewal.py