November 23, 2024, 11:58:07 AM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: lock the file in linux  (Read 7904 times)

Offline chuikingman

  • Linux Noob !
  • *
  • Posts: 6
lock the file in linux
« on: August 31, 2009, 10:32:39 AM »
Hi,

  I want to lock the file in linux and the file cannot be edit or modify by other .I know in perl, there is function flock , but it is not worked.

The file can be modifed and edit even if it is locked by flock .

Any other way to lock the file and so other cannot edit or modifed it ????

Any similar fucntion in perl ????



thank


Offline gauravbajaj

  • LST CareTaker
  • Experienced
  • *****
  • Posts: 658
Re: lock the file in linux
« Reply #1 on: September 02, 2009, 04:47:39 AM »
I belive there is special attributes for this


check  the below command:

ltattr and chattr

I think its somewhat  related to the query what u are asking for.

Offline chuikingman

  • Linux Noob !
  • *
  • Posts: 6
Re: lock the file in linux
« Reply #2 on: September 02, 2009, 04:53:27 AM »
I know the linux comand lsattr and chattr .
but there is no similar function in perl ....
I want to implement in perl script .....
Please advice and suggest !!

Offline chuikingman

  • Linux Noob !
  • *
  • Posts: 6
Re: lock the file in linux
« Reply #3 on: September 02, 2009, 10:52:48 AM »
Any suggestion how to make the "file busy" error by perl script in linux ???
Any idea ???