Re: Flock Explanation

2012-05-23 Thread Craig A. Adams
Hi Kushal, Thanks for the assist. On 24/05/2012 07:05 AM, Kushal Kumaran wrote: If you use the N> FILENAME syntax, the shell will create the file and make descriptor N refer to the named file. You don't have to create the file yourself. Details of this kind of redirection are in the bash man

Re: Flock Explanation

2012-05-23 Thread Kushal Kumaran
On Thu, May 24, 2012 at 12:01 AM, Craig A. Adams wrote: > Thank you for the help rbmj. > > > On 23/05/2012 19:02 PM, rbmj wrote: >> >> a lock, in this case). It then exits the subshell (the section >> surrounded by () parens). > > > What is the effect of exit codes in the script code section? Does

Re: Flock Explanation

2012-05-23 Thread Craig A. Adams
Thank you for the help rbmj. On 23/05/2012 19:02 PM, rbmj wrote: a lock, in this case). It then exits the subshell (the section surrounded by () parens). What is the effect of exit codes in the script code section? Does an exit 0(1,2...) exit just the subshell or the entire script? I am worri

Re: Flock Explanation

2012-05-23 Thread rbmj
On 05/23/2012 12:25 PM, Craig A. Adams wrote: 4. I have no idea what the 200 is. As a blind guess a locking period in seconds or is it an access mode? I believe that the 200 is a file descriptor number. File descriptors are numbers that identify a certain file that is open for reading/writin

Flock Explanation

2012-05-23 Thread Craig A. Adams
Hi, In my thread about automated backup, flock was recommended as a locking solution. I am trying to get my head around flock, so I am hoping someone can explain. A typical flock example seems to read as follows: ( flock -x -n 200 if [ $? != "0" ]; then echo "Unable to obta