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
Solved

Extended attributes?

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Ubuntu not booting - How get past GRUB? 3 57
awk file 6 78
awk to variable in bash 2 70
combine Mutt command with a select statement to distribute file in Linux 2 32
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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.

839 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