sffexec Simple program to run a program and stuff anything displayed it in a file. -------- OPTION 1 ------- This option allows a file with a FipHdr to be run against an ordinary cmd-line program. The Fiphdr can be ripped off beforehand and optionally added back afterwards. if the first parameter starts with a '-' then, the following syntax is used : Input switches are : -C : the contents of the input file are to be piped into the program default: oh no they are not -D : Always delete any existing file with the same name as the output file BEFORE starting default: no -e : Optional extra fipHdr information to add to the output file and/or use for the process default: none -f : File to be used as a I-am-still-running flag default: none (ie to write a Lock file of this name - and remove when finished -F : File to be deleted if the program returns success default: none (success is a return code of zero - some programs are easy to satisify) -i : Name of the input file default: none if the filename does not start with a '/', they the current folder is prepended. -I : preserve any input fiphdr default: rip off before processing -m : maximum time in seconds to wait for the process to end default: 0 for unlimited -o : Name of the output file default: none this is the name of any output file that the program might write. if the filename does not start with a '/', they the current folder is prepended. -O : Do NOT replace the incoming Fiphdr on the output file default: rip and replace -p : Program (in FipSeq if extra data is included) default: none topNtail with single or double quotes if parameters/switches are included eg -p "/perl/bin/perl /fip/local/hohohehe.pl date=\$c\$y\$i\$d infile=\E1 outfile=\E2" or single quotes inside double quotes or -p "/perl/bin/perl /fip/local/hohohehe.pl head='\DI'" -r : Optional name of a file to contain the displayed result default: none ie if the program normally write its output to STDOUT, this file will hold that data if the filename does not start with a '/', they the current folder is prepended. -R : Do NOT replace the incoming Fiphdr on the output file default: rip and replace -V : Display the program to be run in the ALL log default: no -v : display version of program and stop default: no Note that the following are mandatory -i for the input -p for the program A couple of temporary FipHdrs are used internally (in addition to the normal fiphdrs of the incoming file and the -e extra switch) E1 is the '-i' input file E2 is the '-o' input file -p '/usr/bin/xsltproc --nonet -o \E2 NITF2BAUDOT.XSL \E1' Note that the input file is \E1 and the output file should be \E2 .. and it is a good idea to enclose in qtes or dblqtes default is rip off any fiphdr of the incoming file and reapply it on the output - Example - DEBUGGING to screen using -v in xlstproc sffexec -D -p '/usr/bin/xsltproc --nonet --novalid -v -o \E2 /fip/tables/xslt/BELGA_NITF.XSL \E1' -o /tmp/old1 -i /fip/spool/xbelga/ipspool_0_2012-9-21_00:01:51_5_264 | tee /tmp/logold1 -------- OPTION 2 ------- If the first parameter is NOT a '-' then the old syntax is used sffexec "prog and switches" infile logfile inuseflagfile successflagfile timeout var0 var1 var2 var3 var4 var5 var6 In this case, Input variables are MANDATORY 1 - program to use, if any switches, wrap dbl qtes around (see example below) 2 - infile - file to be 'piped' into the program via its 'stdin' 3 - logfile or outputfile - file to be 'piped' from the programs 'stdout' OPTIONAL (MANDATORY from IPSYND) 4 - file to be used as a I-am-still-running flag Either no variable or a null string between 2 dbl qtes means ignore this 5 - file to be deleted if the program returns success (0) Either no variable or a null string between 2 dbl qtes means ignore this OPTIONAL (always) 6 - max time in seconds : sffexec will kill any program taking longer Either no variable or a Zero signifies no timeout. sffexec "/usr/bin/ftp -dinv" /fip/x/TMP.1223 /fip/log/syn/DAISY.FriJan10.182233 Environment variables can be used to define where the system is : SFF_HOME where the home or top queue is. default: /fip eg setenv SFF_HOME /ripexpress/underware SFF_TABLES where the parameter files are default: (SFF_HOME)/tables SFF_LOG where the log files queue is default: (SFF_HOME)/log SFF_SPOOL where the data queues are default: (SFF_HOME)/spool SFF_TMP where the tmp data queues is default: (SFF_HOME)/x THIS MUST BE ON THE SAME UNIX VOLUME as SFF_SPOOL queues. ie if spools are on /data99 which is hard disk /dev/sd0, you MUST also have the TMP queue on the same disk/partition NOTE that for all BUT SFF_HOME, if the parameter starts with a '/' then it is a hard, absolute path; if not then the spool area is under SFF_HOME. eg setenv SFF_SPOOL /data7 will look under /data7 for queues while setenv SFF_SPOOL data7 will look under /fip/data7 Version Control ;2c6 5mar09 added 2nd version of input switches ; added -D and parse in and out filenames ;01b 29mar99 LINUX ;a 01jan03 MACOSX ;b wait3 64bit (copyright) 2018 and previous years FingerPost Ltd.