[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Extended attributes?

Posted on 2016-08-18
2
Medium Priority
?
69 Views
Last Modified: 2016-08-22
I'm looking for a way to 'mark' a file to be backed up. I've been experimenting with stuff like

setfattr -n user.backmeup ~/foo

Open in new window


but the problem with that is if i use getfattr i can't use the exit code to determine whether that attribute was found, and therefore whether the file should be backed up. Any other ideas?
0
Comment
Question by:CEHJ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 41761394
You could try this:

if [[ ! -z $(getfattr -n user.backmeup ~/foo 2>/dev/null) ]]; then
  echo Attribute is set, run backup
    # Your backup command(s) go here; "setfattr -x ..." (?) if successful
 else
   echo Attribute is not set, do nothing
    # Or run other maybe required commands  
fi
0
 
LVL 86

Author Comment

by:CEHJ
ID: 41765153
Thanks. The utility doesn't use its exit codes in the way i'd like, which could have made usage easier and more elegant but i did something pretty similar in the end.

Maybe i ought to use a different file system. fwiw i tried to use ext4's creation time in stat but am told that the kernel calls won't pass the creation time to external tools (!?)
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question