Sponsored Content
Top Forums Shell Programming and Scripting BASH- Hold script until all contents of a file is written Post 302908932 by Michael Stora on Friday 11th of July 2014 03:17:50 PM
Old 07-11-2014
If you can't get the first applicaiton to manipulate a lockfile or otherwise signal your script, you can use incron (a cron like utility for file system events) to signal your second script that it is safe to read.

I use incron to detect the close file event for any file in my public ftp submission directory and as soon as it is done being uploaded, incron launches a script that yanks it away to a non-public directory so that every individual's uploads are private to other users whithout giving everyone a different area.

I also have a web interface to reboot my server, turn on and off anonymous FTP, share or not share my media directories (on/off or for a timeout period), etc. I know very little CGI, so instead of handling it in CGI, I save the state of the user radio button clicks and password hash to a text file and use Incron to detect a change and launch a shell script which parses and interperates it. I did it out of ignorance of CGI but I believe it is very secure.

Mike
This User Gave Thanks to Michael Stora For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replacing contents of files from a bash script

I'm writing a shell script and I need to replace the contents of a configuration file based on what is passed to the script...can I replace expressions in a file from a bash shell script? (2 Replies)
Discussion started by: HumanBeanDip
2 Replies

2. Shell Programming and Scripting

Hangman written in Bash. Suggestions please...

qwertyuiop (1 Reply)
Discussion started by: rorey_breaker
1 Replies

3. Shell Programming and Scripting

Bash copy file contents into an existing file at a specific location

Hi all I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far: File A line 1 line 2 line 3 line 4 ... (6 Replies)
Discussion started by: gshepherd7
6 Replies

4. Shell Programming and Scripting

Most reliable way to store file contents in an array in bash

Hi Guys, I have a file which has numbers in it separated by newlines as follows: 1.113 1.456 0.556 0.021 -0.541 -0.444 I am using the following code to store these in an array in bash: FILE14=data.txt ARRAY14=(`awk '{print}' $FILE14`) (6 Replies)
Discussion started by: npatwardhan
6 Replies

5. Shell Programming and Scripting

Looking for help with parsing file contents in bash [newbie]

Hi I'm just messing around with bash and trying to learn it because I have a course next semester dealing with OS design where we need to know how to use SSH client and either bash or ksh. I've never done shell scripting before. I just started today and I was wondering how parsing files... (1 Reply)
Discussion started by: mehungry
1 Replies

6. Shell Programming and Scripting

Folder contents getting appended as strings while redirecting file contents to a variable

Hi one of the output of the command is as below # sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/' Resource List : <br> *************************** 1. row ***************************<br> ... (2 Replies)
Discussion started by: vivek d r
2 Replies

7. Shell Programming and Scripting

Using sed's hold-space to filter file contents

I wrote an awk script to filter "uninteresting" commands from my ~/.bash_history (I know about HISTIGNORE, but I don't want to exclude these commands from my current session's history, I just want to avoid persisting them across sessions). The history file can contain multi-line entries with... (6 Replies)
Discussion started by: ivanbrennan
6 Replies

8. Shell Programming and Scripting

Shell script (sh file) logic to compare contents of one file with another file and output to file

Shell script logic Hi I have 2 input files like with file 1 content as (file1) "BRGTEST-242" a.txt "BRGTEST-240" a.txt "BRGTEST-219" e.txt File 2 contents as fle(2) "BRGTEST-244" a.txt "BRGTEST-244" b.txt "BRGTEST-231" c.txt "BRGTEST-231" d.txt "BRGTEST-221" e.txt I want to get... (22 Replies)
Discussion started by: pottic
22 Replies

9. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies

10. UNIX for Beginners Questions & Answers

Bash command to find a file and print contents

I need to find a file and print its contents I am trying but it is not working find -path /opt/app-root/src/.npm/_logs -type f -name "*.log" -print Version $ bash -version GNU bash, version 4.4.12(1)-release (x86_64-pc-msys) (1 Reply)
Discussion started by: SVRao19056
1 Replies
incron.conf(5)						       incron documentation						    incron.conf(5)

NAME
/etc/incron.conf - main config file for inotify cron (incron) DESCRIPTION
The file /etc/incron.conf contains default settings for the program incrond. Each line holds a single value pair in the form option = value. Comment lines must have a hash sign (#) in the first line. The valid configuration options are: system_table_dir This directory is examined by incrond for system table files. Default:/etc/incron.d user_table_dir This directory is examined by incrond for user table files. Default:/var/spool/incron allowed_users This file contains users allowed to use incron. Default:/etc/incron.allow denied_users This file contains users denied to use incron. Default:/etc/incron.deny lockfile_dir This directory is used for creating a lock avoiding to run multiple instances of incrond. Default:/var/run lockfile_name This name (appended by '.pid') is used for creating a lock avoiding to run multiple instances of incrond. Default:incrond editor This name or path is used to run as an editor for editing incron tables. Default no editor is given, system editor used, this option overide this. SEE ALSO
incrond(8), incrontab(1), incrontab(5) AUTHOR
Lukas Jelinek <lukas@aiken.cz> (please report bugs to http://bts.aiken.cz or <bugs@aiken.cz>). COPYING
This program is free software. It can be used, redistributed and/or modified under the terms of the GNU General Public License, version 2. Lukas Jelinek 0.5.10 incron.conf(5)
All times are GMT -4. The time now is 11:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy