Informatica change all backslashs in shell commande source by forwardslashs - etl

I have a problem with the escape character. I used a command for a File Reader to generate source in a session and backslash \ for the escape character.
This is the script :
grep '\[' /opt/informatica/fai/conf/DEV/*.prf
The script have been run without error in unix console. But when I ran the session, I encountered a problem. I have seen the session log, the session replaced all the backslash to forwardslash.
this is session log:
Error: [SQ_Shortcut_to_FichierParametrage_Session] Process id 1722. The shell command failed with exit code 2.
ERROR 28/08/2014 14:26:33 node_dev READER_1_1_1 FR_3002 Error reading from file [grep '/[' /opt/informatica/fai/conf/DEV/*.prf]. Operating system error message [No such file or directory].
ERROR 28/08/2014 14:26:33 node_dev READER_1_1_1 BLKR_16034 ERROR: Fetch failed.
The backslash have became the fowardslash.

Related

Error when run simple shell script on opensuse15.1: SubEntry: number of args (2) is invalid

The following error occurred every time I tried to run a simple shell script(test.sh):
SubEntry: number of args (2) is invalid
This single line code is in the test.sh:echo -e 'open 192.168.1.123 \nuser root pass \nput test.csv \nquit'|ftp -inv
If I run the code line directly in the command line works OK: the file test.csv is transferred successfully via FTP on server 192.168.1.123.
Any one know why I get that error when I run the shell script?!Thank you!
I found another solution for sending files via FTP using a script.
I use curl to send the file like this:
curl -T your_file ftp://your_IP
This command can be put in a script and automatic run that script.Works for me.

Error while trying to run shell script using OS process sampler in jmeter

one.jmx file takes command line arguments so i am putting the long command to run one.jmx in a shell script(RUN_GET_CALLS.sh). Now i am using Two.jmx which calls One.jmx via the shell script using OS process sampler.
When i execute Two.jmx it is giving error
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
1548833794770,4,"Patient_""_id""",500,"Exception occurred whilst executing system call: java.io.IOException: Cannot run program ""bash /home/ubuntu/HSDP_Suit/TestSuite/JMX_files/RUN_GET_CALLS.sh"" (in directory ""/home/ubuntu/JMeter/apache-jmeter-5.0/bin""): error=2, No such file or directory",Patient 1-4,text,false,,0,0,6,6,null,0,0,0
I tried putting path in Working directory box also but it is not working
Your syntax is a little bit incorrect you should configure the OS Process Sampler as follows:
Command: /bin/bash
Working directory: /home/ubuntu/HSDP_Suit/TestSuite/JMX_files
Argument #1: -c
Argument #2: ./RUN_GET_CALLS.sh ${PROPERTY_FILE} ${RESOURCE} ${PARAMETERS_STRING} ${FILE_NAME} ${RESULT_FILE}
Example configuration screenshot:
As per bash man page
-c string
If the -c option is present, then commands are read from string. If there are arguments after the string, they are assigned to the positional parameters, starting with $0.
More information: How to Run External Commands and Programs Locally and Remotely from JMeter

Error executing shell command in pig

So I am trying to do something like:
%DECLARE Variable `cat src/documents/item.json`;
Filter BY field = Variable;
But I am getting an error saying:
ERROR org.apache.pig.Main - java.lang.RuntimeException: Error executing shell command: Command exit with exit code of 1
Can someone suggests what's wrong? Thanks!
Most likely "src/documents/item.json" doesn't exist and failing.
Interesting that I fixed
https://issues.apache.org/jira/browse/PIG-5349
just today that would have shown proper error message in addition to the exit code.
With that change, it should print out something like
"cat: src/documents/item.jsonl: No such file or directory"

Error on cron job, but working fine on shell

I am configuring Cron to backup my sql automatically. However I think that Cron has some issues and it's not working well.
This is the command I am running:
mysqldump --opt -Q -uhereisthename -p'hereisthepasswordwithstrangecharactersthatmustbeescaped' databasename | gzip > /home2/username/backups/backupnamefolder/backupdbwebsitename.`date +"%Y-%m-%d"`.gz
When I run it via SSH it works fine and generates the backup.
However if I run it via Cron, I get the following error:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
Anybody can suggest what's wrong?
Cron treats % as a special character (meaning "new line", hence the references to lines 0 and 1 in the error message). You need to escape it:
date "+\%Y-\%m-\%d"
By the way, the posix $( ) syntax is generally better than backticks - it allows nested commands.

Oracle Error Handling in Bash Script

How can I error handling in SQLPlus , printing out customised messages when an error is encountered. I have put my code below.
My Code
#!/bin/bash
echo "My Scripts run below"
sqlplus -S UID1/UID2#DB1<< EOF
whenever sqlerror exit sql.sqlcode;
#/path/Script1
#/path/Script2
exit;
EOF
echo "My Scripts have run"
Output
My Scripts run below
SP2-0310: unable to open file "/path/Script1.sql"
SP2-0310: unable to open file "/path/Script2.sql"
My Scripts have run
Required Output
My Scripts run below
**Below error in Script1**
SP2-0310: unable to open file "/path/Script1.sql"
**Below error in Script2**
SP2-0310: unable to open file "/path/Script2.sql"
My Scripts have run
Indeed, SQLPlus return code is always 0 fr om my experience, so I advise you to do what I had to do in previous projects: redirect scripts output in a file, then parse it to find SPx-xxxx or ORA-xxxx expressions that indicate errors.
WHENEVER SQLERROR detects an error in a SQL command or PL/SQL block. You should use WHENEVER OSERROR instead to catch operating system errors.
WHENEVER OSERROR EXIT FAILURE
If in doubt which error code is returned, you could think about hardcoding a number:
WHENEVER OSERROR EXIT 1
For clarity, I'd change the last EXIT to
EXIT SUCCESS
You won't be able to catch both errors for script1 and script2. After the first error, your SQL*Plus scripts exits and hands back control to bash.
About what to do with the exit code back in bash, see Error handling in Bash

Resources