Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

The learning by 🔥 thread

xvpsxvps Member
edited September 2025 in General

Today, I decided it was a good time to back up my backup files, so I wrote a script.

#!/bin/bash
BACKUP_DIR="/var/backup"
GPG_RECIPIENT="[email protected]"

find "$BACKUP_DIR" -name "*.tar.gz" -exec gpg --encrypt --recipient "$GPG_RECIPIENT" --trust-model always {} \;

rsync -avz --remove-source-files /var/backup/ user@remote_server:/backup/

Then I ran the script, checked the destination server, and realized I had made a small mistake, because it synced everything, including the unencrypted files.

So I deleted the files on the destination server (rm -rf *) and fixed my script by adding --include='*.gpg' --exclude='*' to the rsync line.

Then I ran the script again.

sent 51 bytes  received 12 bytes  42.00 bytes/sec
total size is 0  speedup is 0.00

Please share one of your fuckups, so I feel a little less stupid.

:D

Comments

  • Sorry for your loss but this is a great idea for a thread <3

  • olokeoloke Member, Host Rep
    edited September 2025

    Happens to best of us.

    Also, a small suggestion, the idea with gpg encrypting every tar.gz archive is neat, but there is also rclone with crypt remote. It may actually make your script less sophisticated and thus more error prone :)

    Personally, I didn't have any data loss incidents (yet) but once I made a typo in the /etc/network/interfaces file (something silly like 255.255.25.0) and lost access to a remote server, so I had to drive there just to fix it.

  • tpolltpoll Member, Patron Provider

    This is really helpful :)

    Thanked by 1oloke
  • i may or may not have punched my laptop battery with a screwdriver in attempt to swap out the thermal paste

  • FAT32FAT32 Administrator, Deal Compiler Extraordinaire

    Well my biggest fuck up is still this:

    sudo rm -rf ./
    

    vs

    sudo rm -rf . /
    

    Needless to say I spend a lot of time trying to recover the files

  • I was once fucked by a bind mount

    mount --bind /usr ~/tmp/usr
    rm -rf ~/tmp
    rm test
    command rm not found
    

    I will never forget that moment

  • Always check the file directory or shell you're in. Once I deleted a DB from production thinking I was on dev environment none the less, fuck ups before it taught me to have backups and nothing was lost.

    Thanked by 3xvps oloke BasToTheMax
  • @Rubben said:
    i may or may not have punched my laptop battery with a screwdriver in attempt to swap out the thermal paste

    That's really doing it wrong. Get Arcticlean for next time. Will last forever.

  • plumbergplumberg Veteran, Megathread Squad

    @FAT32 said:
    Well my biggest fuck up is still this:

    sudo rm -rf ./
    

    vs

    sudo rm -rf . /
    

    Needless to say I spend a lot of time trying to recover the files

    Care to explain the difference to n00bz?

    Thanked by 1FAT32
  • plumbergplumberg Veteran, Megathread Squad

    @SillyGoose said:
    Always check the file directory or shell you're in. Once I deleted a DB from production thinking I was on dev environment none the less, fuck ups before it taught me to have backups and nothing was lost.

    You have learned nothing if you had backups and lost nothing

  • sudo rm -rf $typo/$typo variations...

    Thanked by 2plumberg xvps
  • @plumberg said:

    @SillyGoose said:
    Always check the file directory or shell you're in. Once I deleted a DB from production thinking I was on dev environment none the less, fuck ups before it taught me to have backups and nothing was lost.

    You have learned nothing if you had backups and lost nothing

    The greatest part is that we tend of forget passwords by saving them in browsers and other applications!

    Thanked by 1plumberg
  • Please share one of your fuckups, so I feel a little less stupid.

    I wrong mount disk on /etc/fstab (/dev/sdb instead /dev/sdd) for prolong time, and format /dev/sdb cause i thinking backup on /dev/sdd

    Thanked by 1xvps
  • This is the benefit of a Trash/Recycling bin feature. When will systemd fix that, eh?

Sign In or Register to comment.