GithubHelp home page GithubHelp logo

cleverwise / cya Goto Github PK

View Code? Open in Web Editor NEW
80.0 80.0 2.0 72 KB

Easy to use snapshot and restore utility for any Linux (Unix) OS and filesystem powered by BASH

Home Page: https://www.cyberws.com/bash/

License: BSD 3-Clause "New" or "Revised" License

Shell 100.00%
backup backup-directories backup-files backup-profiles bash cya freebsd linux macos openbsd restore restore-utility rollback systemd timer

cya's People

Contributors

cleverwise avatar jontheniceguy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cya's Issues

cya does not handle directory names with spaces

The following setting makes cya fail.

BACKUP_DIRECTORIES="/sys/ /home/dsanroma/directory with spaces/"
[...]
/sys/ ... yes
/home/dsanroma/directory ... skipping - DOESN'T EXIST!
with ... skipping - DOESN'T EXIST!
spaces/ ... skipping - DOESN'T EXIST!
[...]

Similar things happen with MYDATA_xxxx settings with spaces in them.

Maybe the string could be broken up with regex instead of just white spaces.

just a though

Last Profile Used

Hi...

Glad to see the new version is out... great!!!

However, I tried to see the last profile used enhancement but I couldn't. It displays the same info as ver 1.6

I ran a new back-up, but still not there...

I ran a diff on versions 1.6 and 1.7

4c4
< Cover Your Ass(ets) v1.6 on 16 November 2017
---
> Cover Your Ass(ets) v1.7 on 23 December 2017
23c23
< VERSION="1.6"
---
> VERSION="1.7"
1357,1358c1357,1359
< 	echo "Feedback:"
< 	echo "- Tom D."
---
> 	echo "Additional collaborators and testers:"
> 	echo "* David Sanroma (BASH auto completion & last save notation)"
> 	echo "* Tom D. (disclaimer modification)"

No code seems to be there to show the "Last Run" profile used.

I just copied cya to ~/bin... is that correct / enough ?

Just FYI...

TIA,
David

Inconsistent syntax dealing with root directory names with spaces

In order to make root directories names with spaces work, I had to do the following

EXCLUDE_/directory\ with\ spaces/="test3/ with\\ spaces/"

As we can see when the root directory itself has spaces, we can only escape the space with a single \. However, when we need to declare a sub-directory, we need to use the \\ in front of the white space.

This obviously inconsistent, but I don't if it has a solution. If it doesn't, maybe it should be documented.

cya mydata - expand / autocomplete profile names

It would be "really" nice that the command mydata would expand / autocomplete the different profiles defined in the config file.

Following the example, in our config file

MYDATA_johnfiles="/home/john/ /mnt/wd-password/john/"

then

cya mydata [tab]

could result into

cya mydata johnfiles

It would be really nice and useful in order to minimize spelling mistakes.

Bash Tab Completion

Hi,

I am writing a bash completion script for cya. I am trying to make it somewhat "smart" in the sense of context. For example:

cya keep [TAB] would expand name because is part of keep and wait for the name and then expand overwrite or archive only
but
cya directories would not expand name or anything for that matter.

I am having a hard time to get my head around all possible combinations and I wonder if you have them documented or written down somewhere.

Of course, if you like the end result you can have the script ;) and do anything you like with it.

TIA,
David

Roadmap

Is there a roadmap for where this is going?

Are there advantages to this over say a local repo you can install and re-download packages from for the binary repo-available files that are backed up?

cya directories show excluded dirs and files

The directories option is the closest we have to a "config-check" or a "dry-run".

It would be nice to have cya directories show us the directories and files being excluded to be able to double check that we have the configuration file the way we need to, before we run our back up.

ACTION ⯮ Directories & Files Backing Up

Directories:
---------------------------------------------
/bin/ ... yes
/boot/ ... yes
[...]

Files:
---------------------------------------------
/etc/hosts ... yes
/etc/bash_completion.d/git-prompt ... yes
[...]

==============================================

Excluded Directories & Files

Directories:
---------------------------------------------
/usr/games/ ... excluded
[...]

Files:
---------------------------------------------
/usr/local/bin/search ... excluded
[...]

SANATIZE_VAR in cya script

Please do a global search and replace on the string SANATIZE_VAR to SANITIZE_VAR in the cya script - thanks :-)

Show MAX_SAVES value

From an admin and configuration view point it would be nice to have the MAX_SAVES value being shown when checking your directories and files being backed-up.

The directories option works very well to double check that things are the way you expect.

A possible idea could be...

$ cya directories 
☀ Cover Your Ass(ets) v2.2 ☀ 

ACTION ⯮ Directories & Files Backing Up

Copies being kept (MAX_SAVES): 3

Directories:
---------------------------------------------
/bin/ ... yes
/boot/ ... yes
[...]

What if harddisk dies?

From what I understand, CYA needs to work in /home of the partition with the operating system you want to snapshot. So you are out of luck if your HDD/SDD dies? Is there no way to save the system on another HDD/SDD or an external drive?

Some "TODO" suggests, notes, recommendations, smells, etc

https://github.com/terminalforlife/cya/blob/master/cya

Hi, shell lover here. I'm "Squidgy Testicle" on YT. Sorry for the weird name... lol I mentioned that I'd have a look at it.

I've forked the project and gone through the majority of cya itself, until my eyes were about to pop from tiredness. lol Plenty of feedback there, just look out for "#TODO - " in the text, using your editor's search feature. Will revisit tomorrow and follow through with some actual code and testing, but bit drained tonight.

Hope I can be or have been of some help!

missing exclude files from configfile documentation ?

The following is the outline of the configfile documentation (I generated it with grep)

• Additional directories to include in backup:
• Exclude subdirectories from backup:
• Add specific files to include in backup:
• Alter number of rotation backups:
• Backup user data
• Turn off disclaimer notice:

There is a section I am missing (or not seeing)

Exclude files from backup:

The directories seems to show it can exclude individual files...

+++++++++++++++++++++++++++++++++++++++++++++
Excluded Sources:

Directories:
---------------------------------------------
/usr/bin/ ... skipping
/usr/src/ ... skipping
/var/backups/ ... skipping

Files:
---------------------------------------------

If my assumption is correct, I cannot find the documentation to write the proper config line(s).

Question: Changing cya HOME_DIR

I just downloaded cya and was looking at the installation instructions and how to configure it.

The cya home or working directory is /home/cya by default.

However my /home partition (actually a btrfs subvolume) contains only "real" user home directories and i'd like to keep it that way. I have a separate backup subvol (/share/backup) so I was considering moving the cya home to there

However, when I Iooked at the cya script to find where HOME_DIR is set, further down the script I noticed the following lines-

if [ ! -d "${HOME_DIR}" ]
then
        RECOVER_DIR="/mnt/cya/home/cya"

i'm really not a shellscript programmer, but this looks to me as if it effectively harcodes the value of HOME_DIR as /home/cya, because if I move HOME_DIR to- (say) /some/other/mount/point, and then later mount that image under /mnt, wouldn't the lines above need to be-

if [ ! -d "${HOME_DIR}" ]
then
        RECOVER_DIR="/mnt/cya/some/other/mount/point/cya"

?

Maybe i'm mis-understanding this, but it looks to me as if the key line should look more like-

RECOVER_DIR="/mnt/cya${HOME_DIR}"

How to specify to exclude a root level directory

In the config file we can exclude 2nd level directories and downwards with the syntax

EXCLUDE_/usr/="games/"

However how can we exclude a 1st level directory... ? Let's say we want to exclude /usr/ entirely

What would be the syntax then ?

I think I tried this in an earlier version and I think it did not work... maybe I am wrong...

EXCLUDE_//="usr/"

TIA

Using cya mydata <profilename> with EXCLUDE statements

It's not clear from the documentation, but I would like to be able to use cya mydata jon (with the following cya.conf file

MYDATA_jon="/home/jon/ /home/cya/jon"
EXCLUDE_/home/jon/="Dropbox/ Nextcloud/"

Is this currently possible?

cya mydata - multiple source directories

The mydata command and profiles are a great addition to cya.

It would be even more flexible if you could define multiple sources for the same profile.

For example:

MYDATA_johnfiles="/home/john/Downloads/ /home/john/Documents/ /mnt/wd-password/john/"

This syntax would be easy to understand since rsync works the same way. All paths (except last one) would be copied to "destination" (last one).

Needless to say that I would keep it with full paths (like in the example), so source paths do not have to share parent folder.

We do have configuration files in multiple directories in our PBX that could benefit from this enhancement.

That would be very flexible and powerful.

rsync unexpected behavior

Hi...

I discovered that rsync is not behaving like I expected. In addition that makes cya show backup results that are surprising.

I ended up typing this on the CLI

sudo rsync -a --delete --exclude=systemd/ --exclude=cron.d/ /etc/ /home/cya/points/2/etc/

From previous runs cya already put systemd and crond directories there (when I had no exclusions). However, since rsync skips them completely, it does not delete them on destination, even if we have --delete option.

The result is that I ended up with a backup that I did not expect to have systemd nor crond directories, but there they were (from a previous run).

As I said, I think that it is an rsync weirdness...

Right now I can only think on deleting (rm -fr) the excluded directory/file before invoking the rsync command. Just and idea... ;)

I hope you can reproduce the results I have seen... ;)
David

Wonderful, but inconsistent "Currently Doesn't Exist:" section

I am really divided on this one. I really like the "Currently Doesn't Exist:" section. However, it is only used for the "Excluded Sources:" side of things.

The "Included Sources:" section deals with missing assets in a different way.

Included Sources:

Directories:
---------------------------------------------
[...]
/lib32/ ... skipping - DOESN'T EXIST!
[...]

Files:
---------------------------------------------
/home/dsanroma/missing_file ... skipping - DOESN'T EXIST!

Where the "Excluded Sources:` section has it own section

Excluded Sources:
[...]

Currently Doesn't Exist:
---------------------------------------------
/directory with spaces/test4/ ... not on system
[...]

Furthermore, the wording and capitalization are also different " - DOESN'T EXIST!" vs "not on system".

I have no idea what I would do about this one... I just wanted to point it out. ;)

Maybe the differences could be smoothed out a little... ;)

Avoid ambiguity in what forward slash we are referring to

In the configfile command, "Exclude subdirectories from backup" section, we can find the following message

NO FORWARD SLASHES FOR CHILDREN DIRECTORIES!

in order to avoid ambiguity, maybe it could be changed to

NO LEADING FORWARD SLASHES FOR CHILDREN DIRECTORIES!

since we do need the trailing slash for children directories.

Just a thought...

Last Run indicator

Hello,

Would it be possible to add an asterisk (or something) next to the number to indicate more clearly which one is the last one? Example:

Backup Name                                    Date & Time
--------------------------------------------------------------------------------
1*                                             jue 14 dic 2017 21:55:20 CET
--------------------------------------------------------------------------------
2                                              jue 14 dic 2017 19:58:40 CET
--------------------------------------------------------------------------------
3                                              jue 14 dic 2017 19:58:40 CET
--------------------------------------------------------------------------------

I assume it could be done based on the file LAST_RUN

It could be a nice and helpful touch...

TIA,
David

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.