Sponsored Content
Top Forums UNIX for Dummies Questions & Answers "vi"-ing a constantly updated file Post 302115525 by Percy on Wednesday 25th of April 2007 09:47:13 AM
Old 04-25-2007
"vi"-ing a constantly updated file

Hi,

A bit of a dumb question here. Sorry folks.

Suppose I have this file which is being updated at irregular intervals (a few seconds, a few minutes, who knows) by a background process.

I 'vi' this file with the intention of editing it, so it opens up a temp copy as the usual /tmp/720cwhatever

Now suppose, whilst I have this file opened, its updated several times by the background process.

I make my changes, save-quit.

What happens to the updates that were made by the background process during the time I had the file opened?


How do I mitigate this?
(unfortunately, stopping the background process is not an option).


The file is fairly big also (about 40Mb) so it takes vi a few seconds to load it up, save to it etc.....


Unix is ksh.
OS is SunOS.

Hope you guys can help! - thanks in advance!
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

2. Shell Programming and Scripting

Ignore "a line" within /etc/profile only when su'ing

Is there a way to ignore a command within /etc/profile only when su'ing as any particular user. For instance.... As root, if I run "su - oracle -c program" it is running a string in my profile called "echo "^2;$(hostname)-(ABC) @ $(who am i)^G". I don't want the above string to run if I... (9 Replies)
Discussion started by: lwif
9 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

5. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

6. Shell Programming and Scripting

Permission error when "touch"ing file with different user

Hi, There are 2 users (T886072 & T864764) that need to be provided full (rwx) access to a directory. I made the changes to the directory permissions using chmod and setfacl : root@digidb2:# chmod 700 /u02/ftpfiles/MFRS16/discount_rates/ root@digidb2:# setfacl -s... (3 Replies)
Discussion started by: anaigini45
3 Replies

7. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
GETPRIORITY(2)						      BSD System Calls Manual						    GETPRIORITY(2)

NAME
getpriority, setpriority -- get/set program scheduling priority SYNOPSIS
#include <sys/resource.h> int getpriority(int which, id_t who); int setpriority(int which, id_t who, int prio); DESCRIPTION
The scheduling priority of the process, process group, or user as indicated by which and who is obtained with the getpriority() call and set with the setpriority() call. Which is one of PRIO_PROCESS, PRIO_PGRP, or PRIO_USER, and who is interpreted relative to which (a process identifier for PRIO_PROCESS, process group identifier for PRIO_PGRP, and a user ID for PRIO_USER). A zero value of who denotes the current process, process group, or user. prio is a value in the range -20 to 20. The default priority is 0; lower priorities cause more favorable scheduling. The getpriority() call returns the highest priority (lowest numerical value) enjoyed by any of the specified processes. The setpriority() call sets the priorities of all of the specified processes to the specified value. Only the super-user may lower priorities. Additionally, the current thread or process can be placed in a background state by specifying PRIO_DARWIN_THREAD or PRIO_DARWIN_PROCESS for which. Only a value of zero (the current thread or process) is supported for who when setting or getting background state. prio is either 0 (to remove current thread from background status) or PRIO_DARWIN_BG (to set current thread into background state). When a thread or process is in a background state the scheduling priority is set to the lowest value, disk IO is throttled (with behavior similar to using setiopolicy_np(3) to set a throttleable policy), and network IO is throttled for any sockets opened after going into background state. Any previously opened sockets are not affected. The getpriority() call returns 0 when current thread or process is not in background state or 1 when the current thread is in background state. Any thread or process can set itself into background state. RETURN VALUES
Since getpriority() can legitimately return the value -1, it is necessary to clear the external variable errno prior to the call, then check it afterward to determine if a -1 is an error or a legitimate value. The setpriority() call returns 0 if there is no error, or -1 if there is. ERRORS
getpriority() and setpriority() will fail if: [EINVAL] Which is not one of PRIO_PROCESS, PRIO_PGRP, PRIO_USER, PRIO_DARWIN_THREAD, or PRIO_DARWIN_PROCESS. [EINVAL] Who is not a valid process, process group, or user ID. [EINVAL] Who is not 0 when which is PRIO_DARWIN_THREAD or PRIO_DARWIN_PROCESS. [ESRCH] No process can be located using the which and who values specified. In addition to the errors indicated above, setpriority() will fail if: [EACCES] A non super-user attempts to lower a process priority. [EPERM] A process is located, but neither its effective nor real user ID matches the effective user ID of the caller. LEGACY SYNOPSIS
#include <sys/types.h> #include <sys/resource.h> The include file <sys/types.h> is necessary. int getpriority(int which, int who); int setpriority(int which, int who, int value); The type of who has changed. SEE ALSO
nice(1), fork(2), setiopolicy_np(3), compat(5), renice(8) HISTORY
The getpriority() function call appeared in 4.2BSD. 4th Berkeley Distribution June 4, 1993 4th Berkeley Distribution
All times are GMT -4. The time now is 09:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy