Skip to content

Instantly share code, notes, and snippets.

View ProBackup-nl's full-sized avatar
🏠
Working from home

C. Jacobs ProBackup-nl

🏠
Working from home
View GitHub Profile
@ProBackup-nl
ProBackup-nl / ddrfind.sh
Last active June 5, 2023 17:43
ddrescue on a directory recursively (using find) skipping existing equally sized targets preservering metadata
#!/bin/bash
# ddrescue on a directory recursively (using find)
# skipping existing equally sized targets
# preservering metadata
# inspired by the-mikedavis ddrfind.fish
if [ -z $1 ] || [ ! -d $1 ] || [ -z $2 ] || [ ! -d $2 ]; then
echo "Usage: ddrfind.sh <input-dir> <output-dir-that-exists>"
echo "Example: ddrfind.sh /Volumes/A/folder-to-rescue /Volumes/B"
exit 1
@ProBackup-nl
ProBackup-nl / S05syslogd
Created April 16, 2020 12:06
Move syslog to USB drive script, where stop returns firmware state. Tested with RT-N56U router + Padavan firmware.
#!/bin/sh
# save as /opt/etc/init.d/S05syslogd
# chmod +x,go-w /opt/etc/init.d/S05syslogd
# /opt/etc/init.d/S05syslogd start
MOUNT=/media/Main
FOLDER=/Syslog
# better not change anything below here
SOURCE=/tmp/syslog.log # original source of the syslog on /tmp
@ProBackup-nl
ProBackup-nl / pgist.sh
Last active September 6, 2018 16:36 — forked from s-leroux/pgist.sh
Gister to POST or PATCH a single file as public gist. PATCH does gist ID lookup: no need to remember gist ID's
#!/bin/sh
# --------------------------------------------------------
# Shell gister to POST or PATCH a single file as public gist.
# PATCH does gist ID lookup: no need to remember gist ID's
# --------------------------------------------------------
# usage: $ pgist file_to_post_or_patch.extension
#
# installation: $ curl -O https://gist.githubusercontent.com/ProBackup-nl/3971a45b21749cfff6c0069d3dad1dde/raw/pgist.sh && chmod 755 pgist.sh && mv pgist.sh /opt/usr/sbin/pgist
#
# tested with Busybox (ash shell) + Entware (opkg)
@ProBackup-nl
ProBackup-nl / backup.sh
Last active January 7, 2022 12:46
/opt and /etc/storage backup utility for Padavan firmware using rsync
#!/bin/sh
if [ $# = 0 ] || [ $1 = -h ]; then cat <<EOF
--------------------------------------------------------------------------
Pro Backup's handy rotating-filesystem-backup utility for Padavan firmware
--------------------------------------------------------------------------
It makes rotating backup-snapshots of /opt and /etc/storage when called
to a disk that must be prepared with label "Backup". (mkfs.ext4 -L Backup)
Installation: # curl -O https://gist.githubusercontent.com/ProBackup-nl/82fb02c67dc05ca0310d0f9f8e8be14c/raw/68bc28dbdcd7815feb6b5c2715ff121c44e03575/backup.sh && chmod 755 backup.sh && mkdir /opt/usr/sbin && mv backup.sh /opt/usr/sbin/backup
@ProBackup-nl
ProBackup-nl / sub2rbl
Last active February 14, 2024 19:34
sub2rbl for padavan firmware
#!/bin/sh
#
# sub2rbl for padavan firmware @ProBackup-nl
# ============
# Subscribes to IP or CIDR (netblock) RBLs; auto-integrates into iptables
# Purely for reduced memory consumption it creates two IP sets:
# 1. one for unicast IPs (sub2rbl)
# 2. the other one for CIDR (sub2rbl-net) blocks
# Realtime block lists contain both types
#