Sponsored Content
Top Forums Shell Programming and Scripting Make a copy of a file when someone tries to modify the file Post 303043134 by mohtashims on Sunday 19th of January 2020 11:11:32 PM
Old 01-20-2020
Make a copy of a file when someone tries to modify the file

I wish to take a backup of the file when someone tries to modify a file say /tmp/test.txt using vi, vim, cat, copy, mv commands.

I'm aware of inotify which will notify me of any changes to the file however, I wish to make a backup before and not after the changes are made to the file.

I wish to avoid loop check and backup on the file as i believe it will be too time consuming.

Thus, whenever someone makes changes to a file there should exist its backup taken right before the file is modified.

Can you please let me know if and how this is possible to achieve ?

A solution that works across AiX / Linux systems would be great.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can I modify the .bashrc file instead of .profile file to customize my login?

Hello, I got this question which tells me to customize my login script. Some people in the forums suggested to modify the .profile file in my home directory. I did so, but none of my customizations show up when I open the terminal after. So, I tried to modify other files in my home directory,... (1 Reply)
Discussion started by: Hyunkel
1 Replies

2. Programming

makeutility: how to get the make-file name inside of the make-file?

How I can get the current make-file name in a make-file So, if I run make with specified file:make -f target.mak is it possible to have the 'target' inside of the that 'target.mak' from the file name? (2 Replies)
Discussion started by: alex_5161
2 Replies

3. Shell Programming and Scripting

Help with a shell script to modify one line and copy the next 9 to same file

Hi everyone, the problem is quite simple, yet I can't find an easy solution using awk. I need to search for a string in $3, then if I find this string, copy the line,modify $3, and copy the next 9 lines to the same file. My problem is in the copying of the lines... Finding and modifying... (5 Replies)
Discussion started by: Teroc
5 Replies

4. Shell Programming and Scripting

Perl : how to modify a file without generate a temporary file

Hi All, I have a file like below, how can i insert one line after line 1 without using a temporary file in perl? line 1 line 2 line 3 expected result line 1 new line <---insert here line 2 line 3 (2 Replies)
Discussion started by: summer_cherry
2 Replies

5. Shell Programming and Scripting

ksh- redirect stderr to file and then modify the file

I have the following: remsh $host -n 2>>syslog_issue_list.txt grep -i -e "EMS" -e "error" -e "warning" -e "excessive" /var/adm/syslog/syslog.log | awk /"$DATE1"/ | awk -vhost="$host" '!/remsh|telnetd/{print host "\n", $0 >> "syslog_issue_list.txt"}' I am creating a health script that has... (4 Replies)
Discussion started by: chipblah84
4 Replies

6. Shell Programming and Scripting

Modify a file by another file: add new line and variable after string is found

hello, I have problem with writing/adjusting a shell script. I searched forum and unfortunately couldn't write scipt based on the information I found. I never wtire such so it's hard for me and I do need to modify one script immediately. case looks like: 1. 'file' that needs to be modified... (3 Replies)
Discussion started by: bipbip
3 Replies

7. UNIX for Dummies Questions & Answers

Copy and modify a file if the original has changed

Hi there, I have built up my own little "cloud" for my family as the amount of computers grows all day. By now we use 3 smartphones, 2 notebooks und 4 PCs, so this "home cloud" was made to store all personal data (photos, documents,...) and do a backup once in a while. It is running on a Ubuntu... (1 Reply)
Discussion started by: SebSnake
1 Replies

8. Shell Programming and Scripting

Change the file name and copy old file content to new file names.

Hi, I have a files in a directory as below :- ls -1 mqdepth-S1STC02 proc-mq-S1STC01 proc-mq-S1STC02 proc-mq-S1STC03 Whereever i have S1STC i need to copy them into new file with file name S2STC. expected output :- ls -1 mqdepth-S2STC02 proc-mq-S2STC01 proc-mq-S2STC02... (3 Replies)
Discussion started by: satishmallidi
3 Replies

9. Shell Programming and Scripting

Copy directories in make file

LD:=C:/WindRiver/diab/5.9.3.0/WIN32/bin/dld.exe CFILES:=$(wildcard *.c) OBJFILES:=$(subst .c,.o, $(CFILES)) OBJ_PATH:=$(PRJ_PATH)/out/ ADDOBJFILES := $(addprefix $(OBJ_PATH),$(OBJFILES)) FILES:=C:/EB/tresos/workspace/Test_Spi/output/src copyfiles: cp ... (3 Replies)
Discussion started by: ushacy
3 Replies

10. Shell Programming and Scripting

Make copy of text file with columns removed (based on header)

Hello, I have some tab delimited text files with a three header rows. The headers look like, (sorry the tabs look so messy). index group Name input input input input input input input input input input input... (9 Replies)
Discussion started by: LMHmedchem
9 Replies
BACKUP_HELP(8)						       AFS Command Reference						    BACKUP_HELP(8)

NAME
backup_help - Displays help for backup commands SYNOPSIS
backup help [-topic <help string>+] [-admin] [-help] backup h [-t <help string>+] [-a] [-h] DESCRIPTION
The backup help command displays the complete online help entry (short description and syntax statement) for each operation code specified by the -topic argument. If the -topic argument is omitted, the output includes the first line (name and short description) of the online help entry for every backup command. To list every backup command whose name or short description includes a specified keyword, use the backup apropos command. OPTIONS
-topic <help string>+ Indicates each command for which to display the complete online help entry. Omit the backup part of the command name, providing only the operation code (for example, specify dump, not backup dump). If this argument is omitted, the output briefly describes every backup command. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The online help entry for each backup command consists of the following two or three lines: o The first line names the command and briefly describes its function. o The second line lists aliases for the command, if any. o The final line, which begins with the string "Usage", lists the command's options in the prescribed order. Online help entries use the same symbols (for example, brackets) as the reference pages in this document. EXAMPLES
The following example displays the online help entry for the backup dump command: % backup help dump backup dump: start dump Usage: backup dump -volumeset <volume set name> -dump <dump level name> [-portoffset <TC port offset>] [-at <Date/time to start dump>+] [-append] [-n] [-file <load file>] [-help] PRIVILEGE REQUIRED
None SEE ALSO
backup(8), backup_apropos(8) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 BACKUP_HELP(8)
All times are GMT -4. The time now is 02:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy