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
incrontab(1)						       incron documentation						      incrontab(1)

NAME
incrontab - table manipulator for inotify cron (incron) SYNOPSIS
incrontab [-u user] [-f config] file incrontab [-u user] [-f config] [-l | -r | -e | -t | -d] DESCRIPTION
incrontab is a table manipulator for the inotify cron (incron) system. It creates, removes, modifies and lists user tables (incrontab(5)). Each user (including even system users without home directories) has an incron table which can't be manipulated directly (only root can effectively change these tables and is NOT recommended to do so). All informational messages of this program are printed to the standard error output (stderr). If /etc/incron.allow exists only users listed here may use incron. Otherwise if /etc/incron.deny exists only users NOT listed here may use incron. If none of these files exists everyone is allowed to use incron. (Important note: This behavior is insecure and will be probably changed to be compatible with the style used by ISC Cron.) Location of these files can be changed in the configuration. The first form of this command imports a file, validates it and stores to the table. "-" can be used for loading from the standard input. -u (or --user) option overrides the current (real) user to the given one. This option is intended for manipulation with system users' tables (such as apache, postfix, daemon etc.). It can be used only if the current user has root's effective rights. -l (or --list) option causes the current table is printed to the standard output. -r (or --remove) option causes the current table (if any) is permanently remove without any warning or confirmation. Use with caution! -e (or --edit) option causes executing an editor for editing the user table (see below for the information about editor selection). You can edit your incron table now. If the table is changed it stores the modified version. -t (or --types) option causes the list of supported event types (delimited by commas) is printed to the standard output. This feature is intended for front-end applications to find out which event types was compiled in. -d (or --reload) option causes reloading the current table by incrond(8). It is done through "touching" the table (writing into it without modifying it). This feature is intended e.g. for creating watches on newly created files (with already existing rules) or for rearming IN_ONESHOT watches. -f <FILE> (or --config=<FILE>) option specifies another location for the configuration file (/etc/incron.conf is used by default). This feature requires root privileges. There is a few complex algorithm how to determine which editor will be user for editing. If any of the following rule succeeds the appro- priate editor is used: 1. EDITOR environment variable 2. VISUAL environment variable 3. configuration value 4. etc/alternatives/editor 5. hard-wired editor (vim by default) It's not recommended to use graphical editors (such as gVim, KEdit etc.) due to possible problems with connecting to the X server. SEE ALSO
incrond(8), incrontab(5), incron.conf(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 incrontab(1)
All times are GMT -4. The time now is 06:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy