Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a job that runs .sh file but talend shows the complete status though the job still runs. Any idea how to control this so that talend gives the complete status only after .sh execution or all the command completes on .sh file.
Hello,
Are your job running well when you execute .sh file? What does the complete status look like? Could you please give us some trouble screenshots?
Best regards
Sabrina
Hi,
I am using tssh component where it calls .sh file from unix. After i run this job in talend. I see connected, completed and disconnected message on talend console and then I go check on the log that sh file generates, i see these files generated even though status on the talend shows completed.
Below is part of the shell script. This script basically generates log files and has operations like creating tables, inserting data to table and so on. And all these operations complete successfully after talend complete message. I want talend to show me complete after finishing all these operations.
./file.properties
targettable="Account"
echo "Start execution of ${targettable} table execution ${scripts_dir}"
echo "logged at ${log_dir}"
echo "File Datetime: ${FILE_DATETIME}"
echo "queue name: ${queue_name}"
echo "............"
echo "${scripts_dir}${targettable}_TXT_to_HIST.hql"
echo "............"
# creating log files for hive file processing
log_file_name=${log_dir}${targettable}data_load_${FILE_DATETIME}.log
touch $log_file_name
exec >> $log_file_name;
exec 2>> $log_file_name;
echo "successfully created logfile...."
echo $log_file_name
echo "Script executed by `whoami` at `date "+%Y-%m-%d %H:%M:%S"`"
echo "Project directory: $dir_project"
job_message="Populable ${targettable} table"
user=`whoami`
incrementaltable=${targettable}_stg
job_id=1
...contd
Any update to this please. If any questions please let me know.
Hi, this sh file is in unix machine. And I am connecting to execute from Talend.
Hello,
Add wait in shell script
Thanks
Hello,
Suppose cmd is having your script(.sh) then assuming it takes time more than 30 sec (time taking task) then
refer below Script.
Hope it helps!!
cmd="run.sh"
status="Running"
while [ "$status" != "Completed"]
do
result=`ps aux | grep -i "$cmd" | grep -v "grep" | wc -l`
if [ $result -lt 1 ]
then
echo "script $cmd completed sucessfully ! "
status="Completed"
fi
done
echo "Completed the Task"
--
Don't forget to give kudos when a reply is helpful
Thanks,
Give execute permission to your script:
chmod +x /path/to/yourscript.sh
And to run your script:
/path/to/yourscript.sh
Since
.
refers to the current directory: if
yourscript.sh
is in the current directory, you can simplify this to:
./yourscript.sh
https://jiofilocalhtml.run https://forpc.onl