- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- vi editor
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2002 09:36 AM
02-25-2002 09:36 AM
vi editor
I want to restrict multiple administrators simelteneously edit a single file. Is there any way I can do it in vi? My main concern is multiple (including remote) admins try to umdate DNS hosts file. I want this file to be open by only one admin at a give point of time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2002 09:43 AM
02-25-2002 09:43 AM
Re: vi editor
GL,
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2002 09:43 AM
02-25-2002 09:43 AM
Re: vi editor
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2002 09:51 AM
02-25-2002 09:51 AM
Re: vi editor
HTH
mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2002 10:04 AM
02-25-2002 10:04 AM
Re: vi editor
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2002 10:08 AM
02-25-2002 10:08 AM
Re: vi editor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2002 05:00 PM
02-25-2002 05:00 PM
Re: vi editor
The other way is to write a wrapper script for vi (below is a simplistic script which assumes only one parameter and it can be enhanced to your needs) eg.
# mv /usr/bin/vi /usr/bin/vi.bin
# vi /usr/bin/vi
#!/sbin/sh
if [ -e /tmp/$1.vilck ]
then
echo "Someone is currently editing $1. Please try again later..."
exit 1
else
touch /tmp/$1.vilck
/usr/bin/vi.bin $1
fi
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2002 05:02 PM
02-25-2002 05:02 PM
Re: vi editor
I forgot to remove the lock "semaphore" upon exit. Revised as follows:
#!/sbin/sh
if [ -e /tmp/$1.vilck ]
then
echo "Someone is currently editing $1. Please try again later..."
exit 1
else
touch /tmp/$1.vilck
/usr/bin/vi.bin $1
rm -f /tmp/$1.vilck
fi
Hope this helps. Regards.
Steven Sim Kok Leong