Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google site



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-25-2003
Registered User
 

Join Date: Jul 2003
Posts: 14
Unhappy Modify A Program

hi all,

I'm sorry for my english.

I have this problem:
I and my collegues can modify the same file at the same time.
Is it possible delete this problem?

The editor is VI.

thanks.
Sponsored Links
  #2 (permalink)  
Old 07-25-2003
malcom's Avatar
Registered User
 

Join Date: Jul 2003
Location: Germany
Posts: 78
modify problem

Good Morning,

this is not a problem, this is a feature

No, of course you can edit the same file X times at the same time, but when you are not the first one, who edit this file, you will usually get a message, that a temporary file exists.
So you have to accept it and go on with modification, bad idea, or you you have to leave.

Maybe it's a better idea to work locally on your own file, and after editing, you sync your file with the original file, look at cvs for example, its very powerfull.

regards
Alex
  #3 (permalink)  
Old 07-25-2003
davidg's Avatar
Registered User
 

Join Date: Jul 2003
Location: Holland
Posts: 207
Hi,

a solition might be ci/co, standard on HP-ux and Sun (and maybe more). It's a horrible apllication but it keeps you from these problems.

Of course you can write a script that does, the folowing ? :

#!/usr/local/bin/perl
# Script that creates lock-file

$file=$ARGV[0];
@last_f=split(/\//, $file );
@last_f=reverse @last_f;
$last_f = $last_f[0];

if ( -f "/tmp/${last_f}" ) {
print "Sorry, $last_f is still opened by someone else \n";
}
else {
`touch /tmp/${last_f}`;
$cmd = sprintf("/usr/bin/vi %s",$file);
$status = system($cmd);
`rm /tmp/$last_f`;
}

Regs David
  #4 (permalink)  
Old 08-17-2003
cerberusofhnsg's Avatar
Registered User
 

Join Date: Jul 2003
Location: MT
Posts: 43
just make sure not to run that script as root....someone could put a symbolic link where that /tmp lockfile is to point to /etc/nologin, or worse yet /dev/kmem. etc, etc.
  #5 (permalink)  
Old 08-18-2003
pressy's Avatar
pressy pressy is offline Forum Advisor  
solaris cultist
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 726
.......

i think mandatory locking would do what you want...
that forbid multi-access to one file...

chmod +l <file>

read the man page for better explanation...

greetings Preßy
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Please help to modify my script Renjesh Shell Programming and Scripting 6 05-21-2008 09:08 AM
modify and use awk sed program mnnarendra Shell Programming and Scripting 3 03-26-2008 01:08 PM
Modify files amgo UNIX for Advanced & Expert Users 7 12-12-2005 09:19 AM
modify file using awk nattynatty Shell Programming and Scripting 12 04-19-2002 12:59 PM
modify a file yxiao Shell Programming and Scripting 2 03-26-2002 03:38 PM



All times are GMT -4. The time now is 07:46 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0