Kindly help me in this requirement where i want to move files based on its status.
For Eg:
I have 3 dir's
--FileBox Dir
this directory will have all the files which i need to process (in informatica ETL Tool)
--Succeeded Dir
this directory will have files which successfully processed
--Failed Dir
files did not processed
and this is how it should work,
DIR1=tmp/FileBox
DIR2=tmp/Success
DIR3=tmp/Failed
for $file in $DIR1
pmcmd --this command calls my informatica ETL workflow and process the file
if return code for previous command is 0
mv $file $dir2
else mv $file $dir3
i know this code is not even rough work but this is how my script would work:(
Also is there any way to show which file is in -progress something like if i am processing ABC.txt file then while running my scipt, display:
ABC.txt In - progress and same for other files also.
Most Unix and Linux commands return an exit status of zero for success and non-zero for failure. Now, the shell can either catch that exit status and run with it (I'll show you that below) or record it in the reserved shell variable $? . Consider:
true
status_val=$?
if [ status_val -eq 0 ]
then echo success
else echo fail
fi
By appending a command with && or || followed by another command you conditionally execute the second command depending on the status of the first:
false && echo this echo will never be executed
false || echo but this one will
$ uname -a
Linux ucsdv181.symprod.com 2.6.32-696.10.3.el6.x86_64 #1 SMP Thu Sep 21 12:12:50 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
-As of now i dont need to schedule my program i just need to run manually
-In FileBox dir files will be place from upstream so i want to group those files based on certain criteria and send each set of grouped files in different different file lists and process these groups parallely and after processing send files to either success or failed folder
-No i don't need control i just need to see which file is being processed
*I have unix script to group these files and create file lists
Let me know if require any other information.