Solved

Extended attributes?

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Migrating an SQL 2008 database to Oracle 12c 3 88
Trying to make SNMP connection work 7 65
Linux as a middle box 7 62
mcrypt_create_iv() is deprecated 4 69
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

911 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

22 Experts available now in Live!

Get 1:1 Help Now