Sponsored Content
Full Discussion: FileWatcher Script
Top Forums Shell Programming and Scripting FileWatcher Script Post 302251428 by Amit.Sagpariya on Monday 27th of October 2008 06:04:58 AM
Old 10-27-2008
Hi All,

I made the solution for this...

Code:
#!/bin/sh


datafile=$1
indfile=$2

waittime=100
starttime=0
while [ $starttime -le $waittime ]
do
	if [ -f $indfile ]
	then
		do your process (ie run feed validation script)
		exit 0
		
	else
		sleep 10;
		starttime=`echo "$starttime + 10" | bc`
			
		if [ $starttime -eq $waittime ]
		then
			echo "Waittime excceded"
			Get_feed_date=`sqlplus -s amit/amit@amit  <<END 
			set feedback off;
			set heading off;
			select to_char(fdnxtdt, 'YYYYMMDD') from amit where  source_desc='$1';
			exit;
			END`
			
			if [ $Get_feed_date -ne $timestamp ]
				then
					touch xxx.wit
					exit 0
				else
					echo "File has not arrived yet; continue to wait !!"
					starttime=0
				fi
		fi
	fi
done


Last edited by DukeNuke2; 10-27-2008 at 08:48 AM.. Reason: added code tags for better reading
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem with filewatcher...

Hi everyone, Please find the script for Filewatcher rule file,which does the simple job of moving the files whenever it dectects to another directory.And whenever it detects the cmd_mm.stop file,it should terminate the job. INTERVAL 60 ON_FILEWATCH ${HLD}/CMD/* CREATE 0 1 2 0400 5 THEN... (2 Replies)
Discussion started by: bhagat.singh-j
2 Replies

2. Shell Programming and Scripting

create a shell script that calls another script and and an awk script

Hi guys I have a shell script that executes sql statemets and sends the output to a file.the script takes in parameters executes sql and sends the result to an output file. #!/bin/sh echo " $2 $3 $4 $5 $6 $7 isql -w400 -U$2 -S$5 -P$3 << xxx use $4 go print"**Changes to the table... (0 Replies)
Discussion started by: magikminox
0 Replies

3. Shell Programming and Scripting

Autosys filewatcher + ksh script

Hi, A ------> B ------> C I have a scenario where each day, my server B would ftp to server A and pull (A,B,C,D,E) from a specific directory. Server C would need files (B,D) only when server B finished receiving from server A. These files change everyday, so sometimes it takes longer... (3 Replies)
Discussion started by: arex876
3 Replies

4. UNIX for Dummies Questions & Answers

Filewatcher job

Hi Friends iam using a filewatcher job which checks the path in intervals below is the script #!/bin/ksh fileflag=0 timer1=0 check_interval=120 # check every 2 minutes (( check_interval_minutes=${check_interval}/60 )) while do if then echo "My file exists now..." | mailx -s... (7 Replies)
Discussion started by: robertbrown624
7 Replies

5. Shell Programming and Scripting

Generic Filewatcher

Hi, I have a requirement wherein i need to have a generic file watcher in place. On presence of a file in a particular directory,the file watcher should identify the related config file and execute the series of the shell scripts mentioned in the config file. eg.Config file a.sh b.sh... (7 Replies)
Discussion started by: dikesm
7 Replies

6. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

7. UNIX for Dummies Questions & Answers

Calling a script from master script to get value from called script

I am trying to call a script(callingscript.sh) from a master script(masterscript.sh) to get string type value from calling script to master script. I have used scripts mentioned below. #masterscript.sh ./callingscript.sh echo $fileExist #callingscript.sh echo "The script is called"... (2 Replies)
Discussion started by: Raj Roy
2 Replies

8. Shell Programming and Scripting

Filewatcher

hi All, I ned to write a filewatcher script, with following requirements. 1. The script should look for the file in every 5 min. 2. If the file is found, it should check in every 3 min the size of file. 3. if the file size has not changed in last 4 iterations (i.e. in last 12 min), the... (2 Replies)
Discussion started by: alok2082
2 Replies

9. Shell Programming and Scripting

Shell script works fine as a standalone script but not as part of a bigger script

Hello all, I am facing a weird issue while executing a code below - #!/bin/bash cd /wload/baot/home/baotasa0/sandboxes_finance/ext_ukba_bde/pset sh UKBA_publish.sh UKBA 28082015 3 if then echo "Param file conversion for all the areas are completed, please check in your home directory"... (2 Replies)
Discussion started by: ektubbe
2 Replies

10. Shell Programming and Scripting

How to block first bash script until second bash script script launches web server/site?

I'm new to utilities like socat and netcat and I'm not clear if they will do what I need. I have a "compileDeployStartWebServer.sh" script and a "StartBrowser.sh" script that are started by emacs/elisp at the same time in two different processes. I'm using Cygwin bash on Windows 10. My... (3 Replies)
Discussion started by: siegfried
3 Replies
MIDI::Score(3)						User Contributed Perl Documentation					    MIDI::Score(3)

NAME
MIDI::Score - MIDI scores SYNOPSIS
# it's a long story; see below DESCRIPTION
This module provides functions to do with with MIDI scores. It is used as the basis for all the functions in MIDI::Simple. (Incidentally, MIDI::Opus's draw() method also uses some of the functions in here.) Whereas the events in a MIDI event structure are items whose timing is expressed in delta-times, the timing of items in a score is expressed as an absolute number of ticks from the track's start time. Moreover, pairs of 'note_on' and 'note_off' events in an event structure are abstracted into a single 'note' item in a score structure. 'note' takes the following form: ('note_on', I<start_time>, I<duration>, I<channel>, I<note>, I<velocity>) The problem that score structures are meant to solve is that 1) people definitely don't think in delta-times -- they think in absolute times or in structures based on that (like 'time from start of measure'); 2) people think in notes, not note_on and note_off events. So, given this event structure: ['text_event', 0, 'www.ely.anglican.org/parishes/camgsm/chimes.html'], ['text_event', 0, 'Lord through this hour/ be Thou our guide'], ['text_event', 0, 'so, by Thy power/ no foot shall slide'], ['patch_change', 0, 1, 8], ['note_on', 0, 1, 25, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 29, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 27, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 20, 96], ['note_off', 192, 0, 1, 0], ['note_on', 0, 1, 25, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 27, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 29, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 25, 96], ['note_off', 192, 0, 1, 0], ['note_on', 0, 1, 29, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 25, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 27, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 20, 96], ['note_off', 192, 0, 1, 0], ['note_on', 0, 1, 20, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 27, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 29, 96], ['note_off', 96, 0, 1, 0], ['note_on', 0, 1, 25, 96], ['note_off', 192, 0, 1, 0], here is the corresponding score sctructure: ['text_event', 0, 'www.ely.anglican.org/parishes/camgsm/chimes.html'], ['text_event', 0, 'Lord through this hour/ be Thou our guide'], ['text_event', 0, 'so, by Thy power/ no foot shall slide'], ['patch_change', 0, 1, 8], ['note', 0, 96, 1, 25, 96], ['note', 96, 96, 1, 29, 96], ['note', 192, 96, 1, 27, 96], ['note', 288, 192, 1, 20, 96], ['note', 480, 96, 1, 25, 96], ['note', 576, 96, 1, 27, 96], ['note', 672, 96, 1, 29, 96], ['note', 768, 192, 1, 25, 96], ['note', 960, 96, 1, 29, 96], ['note', 1056, 96, 1, 25, 96], ['note', 1152, 96, 1, 27, 96], ['note', 1248, 192, 1, 20, 96], ['note', 1440, 96, 1, 20, 96], ['note', 1536, 96, 1, 27, 96], ['note', 1632, 96, 1, 29, 96], ['note', 1728, 192, 1, 25, 96] Note also that scores aren't crucially ordered. So this: ['note', 768, 192, 1, 25, 96], ['note', 960, 96, 1, 29, 96], ['note', 1056, 96, 1, 25, 96], means the same thing as: ['note', 960, 96, 1, 29, 96], ['note', 768, 192, 1, 25, 96], ['note', 1056, 96, 1, 25, 96], The only exception to this is in the case of things like: ['patch_change', 200, 2, 15], ['note', 200, 96, 2, 25, 96], where two (or more) score items happen at the same time and where one affects the meaning of the other. WHAT CAN BE IN A SCORE
Besides the new score structure item "note" (covered above), the possible contents of a score structure can be summarized thus: Whatever can appear in an event structure can appear in a score structure, save that its second parameter denotes not a delta-time in ticks, but instead denotes the absolute number of ticks from the start of the track. To avoid the long periphrase "items in a score structure", I will occasionally refer to items in a score structure as "notes", whether or not they are actually "note" commands. This leaves "event" to unambiguously denote items in an event structure. These, below, are all the items that can appear in a score. This is basically just a repetition of the table in MIDI::Event, with start- time substituting for dtime -- so refer to MIDI::Event for an explanation of what the data types (like "velocity" or "pitch_wheel"). As far as order, the first items are generally the most important: ('note', starttime, duration, channel, note, velocity) ('key_after_touch', starttime, channel, note, velocity) ('control_change', starttime, channel, controller(0-127), value(0-127)) ('patch_change', starttime, channel, patch) ('channel_after_touch', starttime, channel, velocity) ('pitch_wheel_change', starttime, channel, pitch_wheel) ('set_sequence_number', starttime, sequence) ('text_event', starttime, text) ('copyright_text_event', starttime, text) ('track_name', starttime, text) ('instrument_name', starttime, text) ('lyric', starttime, text) ('marker', starttime, text) ('cue_point', starttime, text) ('text_event_08', starttime, text) ('text_event_09', starttime, text) ('text_event_0a', starttime, text) ('text_event_0b', starttime, text) ('text_event_0c', starttime, text) ('text_event_0d', starttime, text) ('text_event_0e', starttime, text) ('text_event_0f', starttime, text) ('end_track', starttime) ('set_tempo', starttime, tempo) ('smpte_offset', starttime, hr, mn, se, fr, ff) ('time_signature', starttime, nn, dd, cc, bb) ('key_signature', starttime, sf, mi) ('sequencer_specific', starttime, raw) ('raw_meta_event', starttime, command(0-255), raw) ('sysex_f0', starttime, raw) ('sysex_f7', starttime, raw) ('song_position', starttime) ('song_select', starttime, song_number) ('tune_request', starttime) ('raw_data', starttime, raw) FUNCTIONS
This module provides these functions: $score2_r = MIDI::Score::copy_structure($score_r) This takes a reference to a score structure, and returns a reference to a copy of it. Example usage: @new_score = @{ MIDI::Score::copy_structure( @old_score ) }; $events_r = MIDI::Score::score_r_to_events_r( $score_r ) ($events_r, $ticks) = MIDI::Score::score_r_to_events_r( $score_r ) This takes a reference to a score structure, and converts it to an event structure, which it returns a reference to. In list context, also returns a second value, a count of the number of ticks that structure takes to play (i.e., the end-time of the temporally last item). $score2_r = MIDI::Score::sort_score_r( $score_r) This takes a reference to a score structure, and returns a reference to a sorted (by time) copy of it. Example usage: @sorted_score = @{ MIDI::Score::sort_score_r( @old_score ) }; $score_r = MIDI::Score::events_r_to_score_r( $events_r ) ($score_r, $ticks) = MIDI::Score::events_r_to_score_r( $events_r ) This takes a reference to an event structure, converts it to a score structure, which it returns a reference to. If called in list context, also returns a count of the number of ticks that structure takes to play (i.e., the end-time of the temporally last item). $ticks = MIDI::Score::score_r_time( $score_r ) This takes a reference to a score structure, and returns a count of the number of ticks that structure takes to play (i.e., the end- time of the temporally last item). MIDI::Score::dump_score( $score_r ) This dumps (via "print") a text representation of the contents of the event structure you pass a reference to. COPYRIGHT
Copyright (c) 1998-2002 Sean M. Burke. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR
Sean M. Burke "sburke@cpan.org" perl v5.8.0 2002-11-16 MIDI::Score(3)
All times are GMT -4. The time now is 01:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy