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
vxconfigbackupd(1M)													       vxconfigbackupd(1M)

NAME
vxconfigbackupd - disk group configuration backup daemon SYNOPSIS
vxconfigbackupd [-l] DESCRIPTION
The vxconfigbackupd daemon automatically backs up information about a disk group's new configuration whenever the configuration is changed. OPTIONS
-l Logs backup daemon activities to the file /etc/vx/cbr/bkdaemonLog. FILES
/sbin/init.d/vxvm-recover Startup file for vxconfigbackupd. /etc/vx/cbr/bk/dgname.dgid/dgid.dginfo Location of backup file for disk group information. /etc/vx/cbr/bk/dgname.dgid/dgid.diskinfo Location of backup file for disk attributes. /etc/vx/cbr/bk/dgname.dgid/dgid.binconfig Location of backup file for binary configuration copy. /etc/vx/cbr/bk/dgname.dgid/dgid.cfgrec Location of backup file for configuration records in vxprint -m format. NOTES
The vxconfigbackup command can be used to back up a disk group's configuration manually at any desired time. The disk group configuration backup and restore utilities do not save any data in the public region. This includes file system or other application data that is configured within VxVM objects. When a disk group is destroyed, its configuration backup information (including the backup directory) is also removed. The only exception to this behavior is when the disk group is in the precommit state of restoration. The backup directory should be large enough to accommodate copies of all the currently imported disk groups. The minimum recommended size of the backup directory is P * (N + 1) megabytes, where P is the private region in megabytes (by default, 32MB), and N is the number of disk groups. The additional P megabytes is required to hold a temporary copy of the disk group configuration when a disk group is imported or a configuration change is made. The default backup directory is /etc/vx/cbr/bk. The location of the backup directory can be configured by using the vxconfigbackup -l backup_directory_path command. SEE ALSO
vxconfigbackup(1M), vxconfigrestore(1M) VxVM 5.0.31.1 24 Mar 2008 vxconfigbackupd(1M)
All times are GMT -4. The time now is 05:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy