Solved

Extended attributes?

Posted on 2016-08-18
2
45 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 500 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

708 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now