Save my bacon.


save-my-bacon
A shell script which could save your career :)

If you don't get this don't worry, its for Linux geeks.

Every System administrator's nightmare is wiping a system, and I'm sure we've all panicked whilst looking for backups.

It would be nice to have a recycle bin not only for the user interface but the shell as well.

That's what I've written in bash, as a debian and redhat package.

Deleting more than a gigabyte of stuff? If you are it asks for confirmation, this value can be set in the config file, at /etc/recycled.conf

  • Won't it conflict with my scripts? No it won't as it's aliased in your ~/.bashrc file, it only applies when in the shell.
  • Files to be removed are stored in /recycled/UID/timestamp
  • The user name is symlinked to the user id as the user id does not change
  • It covers files replaced by the delete (rm), move (mv) and copy(cp) commands
  • To ignore it's use, pass -z and it will be bypassed.
  • It adds a cron entry in /etc/cron.daily to purge items in the recycled folder older than 2 days, or as set in the configuration file
  • It doesn't ask for confirmation when deleting from /recycled.

The /etc/recycled.conf file contains the settings:

  • warning_size_limit=1000000 // warn if deleting / replacing more than n kilobytes of data. This removes the backup facility of this script.
  • interactive_mode="true" /// Force -i on each command run to ask before overwriting, good when trying this script.
  • keep_for_days=0 // A cronjob will delete files from the /recycled folder older than n days as set by this command.

To use as this gitlab repository please copy the recycled.conf file to /etc, the purge_old_recycled_files.sh to /etc/cron.daily and the save-my-bacon file to /usr/bin, or use our debian and redhat packages as listed below:


Check our other amazing projects.

Finally: I wrote Tuxconfig a while ago, as my dissertation at Kent university for my course in Advanced Computer science. It's a Linux based version of the Windows device installer Wizard.

Anyway seeing as my portfolio proves I can write quality software I'm thinking of relaunching it in python with several modifications. If you are Linux foundation, Ubuntu or an open source player and wish to sponsor it please get in touch at [email protected]

Thanks for reading,

Roblet

Want to see / contribute to the source? It's at: https://gitlab.com/rydal1/save-my-bacon

Debian package here and Redhat package: here


Check our other amazing projects.