[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Extended attributes?

Posted on 2016-08-18
2
Medium Priority
?
71 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
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month18 days, 17 hours left to enroll

834 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