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
25% Recurring Discount on NVMe VPS
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
CloudLinux
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 2FAT32 x1arch
  • 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?

  • vicayavicaya Member

    @vicaya said:
    sudo rm -rf $typo/$typo variations...

    Looks like the latest GPT-5.6-Sol made yet another variation of this mistake:

    https://news.ycombinator.com/item?id=48865230

  • I had a storage server which had hdd and ssd.

    I used the template to reinstall.

    Voosh!

    5 TB data gone down the drain. No backup, nothing.

  • Used to work at a fairly large Minecraft server network. Was running on many all nighters working for an upcoming server release. Usually all servers will have a dev server for staging/QA that can then be pulled from for updates/releases, this server did not. This specific server would go down at end of the map, and be down for days/weeks until time for new map release (I did not decide this). When I started working on the release, I made a backup of the old map called ${Server}-Old and then copied that into ${Server}, in the same directory. And then I went to work in the new directory.

    Release coming up, 2 in the morning, 7 hours until release. I was finally done and started to go through release checklist before going to bed. I went up a directory, and after typing the mandatory ls after cd, noticed the backup and went to delete it.

    I had to pull another all nighter.

  • daviddavid Member

    rsync --delete with the source and target switched (deleted all the source files since the target was empty).

    Thanked by 2host_c sillycat
  • forestforest Member
    edited 6:53AM

    @david said:
    rsync --delete with the source and target switched (deleted all the source files since the target was empty).

    That's why I have alias rsync="rsync -n" and type \rsync to override the alias when I'm ready.

    Thanked by 1david
  • daviddavid Member

    @forest said:

    @david said:
    rsync --delete with the source and target switched (deleted all the source files since the target was empty).

    That's why I have alias rsync="rsync -n" and type \rsync to override the alias when I'm ready.

    When I'm remembering that, I'll sometimes remove the "--delete" on the first run, since the target is empty, anyway.

  • LeviLevi Member

    I have dumped backups to wrong server. And aknowledge that after 2 months. Client held backups without knowing that.

  • forgot to takeout --dry-run on a rsync production monthly backup script. didn't get caught until i have to update the hypervisor (3 months later) and making a checklist the backup must be 1:1 before anything funny being done

    Thanked by 1forest
  • dbadudedbadude Member

    I deleted once all my code accidentally after working 30 hours straight without any sleep. when you get tired your hands brain coordination turns into self destructing mode apparently.
    OMG so many mistakes i made, its part of life. Trick is to minimize the exposure to critical tasks. Like have data backups, redundant hardware, a disaster recovery plan, transaction based processing, version control. Correctly dosed caffeine levels and last but not least Enough sleep. LOL

  • dbadudedbadude Member

    @Levi said:
    I have dumped backups to wrong server. And aknowledge that after 2 months. Client held backups without knowing that.

    i remember something similar happened restoring a backup to production when it should be done to an acceptance server. Oops, a very common mistake.

Sign In or Register to comment.