Skip to content

cbaoth/Useful-Scripts

Repository files navigation

Some random shell/python scripts

Created and intended for my personal use only. Some of these are ancient and most not well maintained, so if anyone stumbles upon this repo: Be warned, read/use at your own risk. :)


bedtime-shutdown.sh - 😴 Digital Detox: Bedtime Enforcer

If you find yourself doom-scrolling or debugging at 02:00 (2 AM), this script is your new best friend (or worst enemy). It forces a system shutdown at a set time every night to make sure you actually get some sleep.

Features:

  • Scheduled shutdown with configurable "Bedtime Zone" and "Safe Zone" times

  • User notifications via desktop and terminal (wall)

  • Configurable grace periods for user and system

  • Emergency override options (USB stick, USB device ID, or block device label)

  • Dry-run mode for safe testing (can run as non-root with readable config)

  • Comprehensive logging with optional log file support

  • Multiple verbosity levels for debugging

Quick Start:

# Optional: Test in dry-run mode first (no sudo or system changes needed!)
cp bedtime-shutdown/bedtime-shutdown.conf /tmp/bedtime-shutdown.conf
editor /tmp/bedtime-shutdown.conf
./bedtime-shutdown/bedtime-shutdown.sh --config /tmp/bedtime-shutdown.conf --dry-run -v

# Deploy and configure (requires sudo)
cd bedtime-shutdown
sudo ./install.sh
sudo editor /etc/bedtime-shutdown.conf
# Now follow the instructions shown by the install script (systemd service unit/timer etc.)

📖 Full Documentation: See bedtime-shutdown/README.adoc for detailed installation, configuration, and usage instructions.


nextcloud-maintenance.sh - 🔧 Nextcloud Maintenance Script

Intended for use in cron with cronic (for info mail) to perform maintenance tasks and integrity/update checks on nextcloud servers, or simply to run before/ahfter an update.

Stuff like:

  • occ db:add-missing-indices

  • occ maintenance:repair

  • occ integrity:check-core

  • occ integrity:check-app "$app"

  • occ app:update --all --showonly

  • occ update:check


openvpn-client-cfg.sh

A small openvpn client cretificate and config helper tool

Usage:
  openvpn-client-cfg CLIENT_NAME [--ip IP] [--remote HOST] [--routes "NET1/MASK,NET2/MASK"] [--no-split] [--force]
  openvpn-client-cfg --list
  openvpn-client-cfg --delete CLIENT_NAME
  openvpn-client-cfg --revoke CLIENT_NAME

Options:
  --ip IP           Assign static IP via CCD (topology subnet; /24 mask assumed)
  --remote HOST     Override remote host (default: 11001001.org)
  --routes CSV      Extra routes for split-tunnel (e.g. "192.168.1.0/24,10.23.0.0/16")
  --no-split        Do NOT add route-nopull (internet / non-vpn traffic routed through vpn)
  --force|-f        Override safety checks (IP duplicate/subnet/CCD overwrite)

  --list|-l         List CCDs with optional IPs and cert expiry

  --delete|-d NAME  Disable a client by moving CCD to ccd.disabled (no revoke)
  --revoke|-r NAME  Revoke client's cert, refresh CRL, disable CCD

Example:
  # Create a new client configuration named "myworkstation" using static IP 10.10.0.5
  openvpn-client-cfg myworkstation --ip 10.10.0.5

Env overrides:
  EASYRSA_DIR=/home/cbaoth/openvpn-ca
  SERVER_CONF=/etc/openvpn/server/server.conf
  CCD_DIR=/etc/openvpn/ccd
  OUTPUT_DIR=/home/cbaoth

audio-volume.sh

Toggle mute and change volume using hotkeys within the wm.


backup.sh

Backup script with exclusion list, supports full and incremental backups.


backup2ftp.sh

Upload last backup (made by backup.sh) to an ftp server, preserve previous backup on ftp.


clear-cache.sh

Clean up home folder by removing (known) local caches, temp files etc.


dbbackup.sh

Backup script for mysql and postgresql.


Create a very simple image gallery (static html file with static thumbs).


pdfprint.sh

Print a pdf/ps file using psnup for multi page per sheet printing.


smfetch.sn

Fetch rtmp / http(s) streams from some known (mostly german) tv stations and pages like youtube using wget and rtmpdump.


wgetmp.py

Fetch multiple files in parallel using wget.


getbyext.sh

Fetch all media files (or specific files by ext.) from a given url using wget.

About

Some useful shell scripts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published