Command chain vmkping all script and return results in a txt file

Hi guys, hope you all are doing it very well?

Does anyone know if there is a way I can put this together?

What I'm trying to do here is to circumvent the tedious process of ping every IP configured for my target iSCSI through each VMK of each host.

So basically I want some advice from you guys for what I can basically get this in a script.

vmkping - I vmk1 10.0.0.10

vmkping - I vmk2 10.0.0.10

vmkping - I vmk3 10.0.0.10

vmkping - I vmk4 10.0.0.10

vmkping - I vmk5 10.0.0.10

vmkping - I vmk6 10.0.0.10

vmkping - I vmk7 10.0.0.10

vmkping - I vmk8 10.0.0.10

vmkping - I vmk9 10.0.0.10

vmkping - I vmk1 10.0.0.11

vmkping - I vmk2 10.0.0.11

vmkping - I vmk3 10.0.0.11

vmkping - I vmk4 10.0.0.11

vmkping - I vmk5 10.0.0.11

vmkping - I vmk6 10.0.0.11

vmkping - I vmk7 10.0.0.11

vmkping - I vmk8 10.0.0.11

vmkping - I vmk9 10.0.0.11

vmkping - I vmk1 10.0.0.12

vmkping - I vmk2 10.0.0.12

vmkping - I vmk3 10.0.0.12

vmkping - I vmk4 10.0.0.12

vmkping - I vmk5 10.0.0.12

vmkping - I vmk6 10.0.0.12

vmkping - I vmk7 10.0.0.12

vmkping - I vmk8 10.0.0.12

vmkping - I vmk9 10.0.0.12

etc... etc...

Do this on all hosts is to take more time than I'd like to take. Because we are busy of troubleshooting an issue on our switches where some of the ports VMK are unable to communicate to the target. Is there anyway that we can this script?

Please guys, I'm desperate here.

Kind regards

Johan

You can do it from a bash script.

This is a working script that gets a list of all the vmkernel ports then each IP provided in a file list.txt on each vmkernel port pings. The results are printed to the screen but to get the results to just the output of the line pipe.

Here is an example:

"sh vmkping.sh > / tmp/vmkpingResults.log".

#! / bin/bash

# Name of the program: vmkpingall.sh

# Store a file list.txt with each target IP storage on a separate line

#---EXEMPLE list.txt-

#172.16.191.50

#172.16.192.50

#-----------------------------

#Print the date and host name

Date

host name

#get a list of all the ports of vmk on the host

for vmknum $ (esxcli network ip interface list | grep vmk | grep - v name :))

do

White space #Trim

vmkCompare = "${vmknum # * ()}" "

#Trim trailing whitespace

vmkCompare = "${vmkCompare % * ()}" "

# Exclude vmk0, because we do not use our management traffic vmotion vmkernel port so pings are supposed to do not on vmk0

If ["$vmkCompare"! = "vmk0"]; then

Cat /path-to-script/list.txt |  while reading output

do

#use vmkping port command selected vmk '-I ' ping target IP addresses

vmkping - I "$vmknum" - ch. 1 "$output" >/dev/null

If [$?-eq 0]; then

echo 'node $output's place on $vmknum

on the other

echo "$output node is down on $vmknum.

FI

fact

FI

fact

Tags: VMware

Similar Questions

  • How to execute a Perl script and returns the value as a string?

    Hi, I am trying to build an application using the eclipse 2.0.0 with the Blackberry SDK 7.1 plug-in. currently I tested Simulator 9900 version 7.1.0.523. I need to use the Perl language to access the raw biological database and returns as a string without having to write a longer program using java.

    In a stand alone Java SDK, I can use the line:

    Process p = Runtime.getRuntime () .exec ("perl script.pl")

    but when I tried to use it on the IDE for a Blackberry project, the project will not compile. It is said:

    Method exec (String) is undefined for the type of Runtime

    Hopes, can someone show me the correct syntex to use, but if no class is available, could someone show me a sample for unified research process? The names of blackberry dev is very complicated, I can't find any samples for her.

    Thank you.

    Seems interesting.

    Your idea was to download the data to the BlackBerry and then directly execute queries.

    Although there are a number of other obstacles, the first fall you in East platforms supporting Perl.  Here is the list:

    http://perldoc.Perl.org/perlport.html#supported-platforms

    BlackBerry OS Java is not included - in fact the only ' included phone OS is Symbian.  Interestingly, it seems likely that PlayBook and BB10, because they are based on the QNX operating system.

    If we discard Perl as a query language, then you will need to provide another option to search.  I think that unified search is an option, but you will have some work to do to use it.  The first thing you should do is find out if in fact, you can download the database on the BlackBerry.  The only available on the Blackberry database engine's SQL, so if you want the database can be exported to a SQL database, there is a chance that it would work.  I had a quick glance around the site, and I can't tell what the "database" is in the format.  Then I suggest that look you at that next.

    I hope this helps.

  • What is the difference between the output of the Script and the result of the query?

    Hello gurus,

    In Oracle SQL Developer, during the execution of a select statement running with the "F5 key", I get the output of the Script; And then if I execute the same select statement using 'Ctrl + Enter', I get basically the same data, but it is formatted to be a little different. and using 'Ctrl + Enter' I can adjust and reduce the size of the column (not the logical and physical structure) on the GUI screen to display all columns without having wide apart. What are the advantages/disadvantages to running queries using "F5" or "Ctrl + Enter"? If someone could shed some light on this topic bit, that would be nice.

    HI HAS LUNS,

    Text (f5) is functional, for the better or for the worst dumps select all.
    Chart is prettier - you get a complete data by select grid and scroll within the grid.
    There are a few other minor differences.

    Personally, I use mostly f5 /text/ (sqlplus emulation).

    -Turloch
    Team SQLDeveloper

  • Remove # and clear the line from txt files

    Hello

    I have problem with my program.

    I need to remove the empy lines in my txt file.

    This is file look like:

    # Standard capacitance data file
    # Model capacity: parallel (K = 3.0)
    # Created by: ECT32v2 for Beta2.25 of Win32 (July 10, 2003 01:54:24)
    # Source: rec_flow_f45_v800_n2.bcp
    # Description: contents of the buffer to capture mode
    # Date: 12:04:43 GMT standard time, 29 March 04
    # Electrodes = 8, measures = 28
    # Data for plan 1

    # 1 frame (0 msec)
    0.006-0,001-0.004-0, 002 - 0.028-0.031-0,002
    -0.008-0, 005 - 0.007 - 0.024 0.005 0.004
    -0.014-0, 002 - 0.011-0.004 0.002
    -0.008 - 0.003 - 0.004 0.003
    -0.011 0.001 0.002
    0.005 0.004
    0,008

    # structure 2 (10 ms)
    -0.002 0, 005 - 0.008 0.006-0,002 0,023 0.011
    -0.008-0.004 - 0.004 - 0.003 0.010 0.001
    -0.007-0,001-0,012 0.007 0,008
    -0.015-0.004 0.002 0.001
    -0.007-0,002 0.001
    -0.002 0,008
    0.005

    I want to remove all empty lines, lines containing ' # '.

    I try as an attachment, but it does not work.

    How can I do this?

    Regads,
    Sorry for my English

    Ben Merci for example. Somehow, I missed the framework which enabled search expresion. Your example has sent me to the help files to understand. I have modified my first code for the show method, I hope I have the correct explanation. Not trying to do someones homework for them, but for those who need a quick start, maybe this will help someone else along the way.

  • with utl_file - save the result in a txt file.

    PLS, help...

    I have a question that I used to use SQL PLUS, using the COIL and it worked very well.

    Now, I'm changing it to pl/sql, which I'll have to use UTL_FILE.

    The problem is that I need to create a file with a pre defined provision.

    Can help you me pls?

    Don't have much experience with UTL_FILE

    Prompt 'Periodo MON-YY:'
    Define periodo = '&periodo'
    SPOOL C:\Users\gtorrens\Documents\GLAudit_2014_2015\gl_audit-&&periodo..txt
    set termout off
    set echo off
    set verify off
    set feedback off
    set serveroutput off
    set head off
    set pagesize 0
    set linesize 608
    set timing off 
    SELECT /*+
             INDEX(GCC GL_CODE_COMBINATIONS_U1)
             INDEX(GJB GL_JE_BATCHES_U1)
             INDEX(FUS FND_USER_U1)
             INDEX(GJL GL_JE_LINES_U1)*/
              rpad(SUBSTR (gcc.segment1, 1, 2),2,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (emp.de_sgm, 1, 70), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),70,' ')
               || rpad(SUBSTR (gjs.user_je_source_name, 1, 20),20,' ')
               || lpad(DECODE (NVL (gjl.entered_dr, 0)
                        , 0, DECODE (NVL (gjl.accounted_dr, 0), 0, 'C', 'D')
                        , 'D'),1,' ')
               || lpad(TO_CHAR (gjh.default_effective_date, 'DD-MON-YY'),9,' ')
               || lpad(TO_CHAR (gjh.posted_date, 'DD-MON-YY'),9,' ')
               || lpad(SUBSTR (gcc.segment2, 1, 9),9,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (cta.de_sgm, 1, 100), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),100,' ')
               || rpad(SUBSTR (cta.tp_sgm, 1, 10),10,' ')
               || lpad(TO_CHAR (NVL (gjl.accounted_dr, 0),'999G999G999G999G999G990D00'),38,' ')
               || lpad(TO_CHAR (NVL (gjl.accounted_cr, 0),'999G999G999G999G999G990D00'),38,' ')
               || lpad(SUBSTR (gjh.currency_code, 1, 5),5,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (REPLACE (SUBSTR (gjl.description, 1, 150), '|', '@'), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),150,' ')
               || rpad(gjb.last_updated_by,15,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (gjb.name, 1, 100), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),100,' ')
               || lpad(SUBSTR (fus.user_name, 1, 30),30, ' ')
                 linha_utl
          FROM gl_je_lines gjl
             , gl_je_headers gjh
             , gl_code_combinations gcc
             , gl_je_sources gjs
             , gl_je_batches gjb
             , (SELECT 'EMPRESA' id_sgm
                     , a.flex_value cd_sgm
                     , b.description de_sgm
                     , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                             , 'L', 'Passivo'
                             , 'A', 'Ativo'
                             , 'E', 'Despesa'
                             , 'O', 'Pat.Liq'
                             , 'R', 'Receita')
                         tp_sgm
                  FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                 WHERE a.flex_value_set_id = 1015197
                   AND a.flex_value_id = b.flex_value_id
                   AND b.language = 'PTB') emp
             , ( SELECT 'CONTA' id_sgm
                       , a.flex_value cd_sgm
                       , b.description de_sgm
                       , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                               , 'L', 'Passivo'
                               , 'A', 'Ativo'
                               , 'E', 'Despesa'
                               , 'O', 'Pat.Liq'
                               , 'R', 'Receita')
                           tp_sgm
                    FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                   WHERE a.flex_value_set_id = 1015237
                     AND a.flex_value_id = b.flex_value_id
                     AND b.language = 'PTB') cta
             , fnd_user fus
         WHERE gjl.je_header_id = gjh.je_header_id
           AND gjb.je_batch_id = gjh.je_batch_id
           AND gjs.je_source_name = gjh.je_source
           AND gjh.ledger_id = 2041 -- p_nr_livro
           AND gjh.actual_flag = 'A'
           AND gjh.period_name = upper('&&periodo') -- 'JAN-14'
           AND gcc.code_combination_id = gjl.code_combination_id
           AND gcc.segment1 IN ('01', '12', '13', '14', '05', '16', '18')
           AND emp.id_sgm = 'EMPRESA'
           AND emp.cd_sgm = gcc.segment1
           AND cta.id_sgm = 'CONTA'
           AND cta.cd_sgm = gcc.segment2
           AND fus.user_id = gjb.last_updated_by
        --  AND rownum<1001
           ;
        SELECT /*+
             INDEX(GCC GL_CODE_COMBINATIONS_U1)
             INDEX(GJB GL_JE_BATCHES_U1)
             INDEX(FUS FND_USER_U1)
             INDEX(GJL GL_JE_LINES_U1)*/
                    (lpad(TO_CHAR (NVL (SUM(gjl.accounted_dr), 0),'999G999G999G999G999G990D00'),268,' ')) /*VL_DEBITO*/
             ||' '||(lpad(TO_CHAR (NVL (SUM(gjl.accounted_cr), 0),'999G999G999G999G999G990D00'),37 ,' ')) /*VL_CREDITO*/
             ||' '|| TO_CHAR (COUNT (*)) soma /*qtd_reg*/
          FROM gl_je_lines gjl
             , gl_je_headers gjh
             , gl_code_combinations gcc
             , gl_je_sources gjs
             , gl_je_batches gjb
             , (SELECT 'EMPRESA' id_sgm
                     , a.flex_value cd_sgm
                     , b.description de_sgm
                     , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                             , 'L', 'Passivo'
                             , 'A', 'Ativo'
                             , 'E', 'Despesa'
                             , 'O', 'Pat.Liq'
                             , 'R', 'Receita')
                         tp_sgm
                  FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                 WHERE a.flex_value_set_id = 1015197
                   AND a.flex_value_id = b.flex_value_id
                   AND b.language = 'PTB') emp
             , ( SELECT 'CONTA' id_sgm
                       , a.flex_value cd_sgm
                       , b.description de_sgm
                       , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                               , 'L', 'Passivo'
                               , 'A', 'Ativo'
                               , 'E', 'Despesa'
                               , 'O', 'Pat.Liq'
                               , 'R', 'Receita')
                           tp_sgm
                    FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                   WHERE a.flex_value_set_id = 1015237
                     AND a.flex_value_id = b.flex_value_id
                     AND b.language = 'PTB') cta
             , fnd_user fus
         WHERE gjl.je_header_id = gjh.je_header_id
           AND gjb.je_batch_id = gjh.je_batch_id
           AND gjs.je_source_name = gjh.je_source
           AND gjh.ledger_id = 2041
           AND gjh.actual_flag = 'A'
           AND gjh.period_name = '&&periodo' -- 'JAN-14'
           AND gcc.code_combination_id = gjl.code_combination_id
           AND gcc.segment1 IN ('01', '12', '13', '14', '05', '16', '18')
           AND emp.id_sgm = 'EMPRESA'
           AND emp.cd_sgm = gcc.segment1
           AND cta.id_sgm = 'CONTA'
           AND cta.cd_sgm = gcc.segment2
           AND fus.user_id = gjb.last_updated_by
          -- and rownum<1001;
                  
    spool off;
    
    

    I did something like that, when I turned it in a procedure...

    create or replace PROCEDURE       XXTVGAUDIT (o_return_err      OUT VARCHAR2
                                                  , o_return_code     OUT NUMBER
                                                  , p_period_name  IN     VARCHAR2
                                                  , p_nr_livro     IN     NUMBER)
    IS
      CURSOR c1
      IS
    SELECT
              rpad(SUBSTR (gcc.segment1, 1, 2),2,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (emp.de_sgm, 1, 70), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),70,' ')
               || rpad(SUBSTR (gjs.user_je_source_name, 1, 20),20,' ')
               || lpad(DECODE (NVL (gjl.entered_dr, 0)
                        , 0, DECODE (NVL (gjl.accounted_dr, 0), 0, 'C', 'D')
                        , 'D'),1,' ')
               || lpad(TO_CHAR (gjh.default_effective_date, 'DD-MON-YY'),9,' ')
               || lpad(TO_CHAR (gjh.posted_date, 'DD-MON-YY'),9,' ')
               || lpad(SUBSTR (gcc.segment2, 1, 9),9,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (cta.de_sgm, 1, 100), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),100,' ')
               || rpad(SUBSTR (cta.tp_sgm, 1, 10),10,' ')
               || lpad(TO_CHAR (NVL (gjl.accounted_dr, 0),'999G999G999G999G999G990D00'),38,' ')
               || lpad(TO_CHAR (NVL (gjl.accounted_cr, 0),'999G999G999G999G999G990D00'),38,' ')
               || lpad(SUBSTR (gjh.currency_code, 1, 5),5,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (REPLACE (SUBSTR (gjl.description, 1, 150), '|', '@'), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),150,' ')
               || rpad(gjb.last_updated_by,15,' ')
               || rpad(TRANSLATE (
                    CONVERT (
                    TRANSLATE (
                        REPLACE(REPLACE (REPLACE (SUBSTR (gjb.name, 1, 100), CHR (13), ''), CHR (10), ''),CHR (9), '')
                       ,'??????????????????¡§©³º ¨¬²¹¢ª®´»£µ«¼!@#$%*()_+=[]{}/\?:<>|ãÃõÕçÇüÜâÂêÊôÔáÁàÀéÉíÍóÓúÚñшÞ'
                       ,'                                                             aAoOcCuUaAeEoOaAaAeEiIoOuUnN  ')
                   ,'US7ASCII'
                   ,'WE8ISO8859P1') ,'?',' '),100,' ')
               || lpad(SUBSTR (fus.user_name, 1, 30),30, ' ')
                 linha_utl
          FROM gl_je_lines gjl
             , gl_je_headers gjh
             , gl_code_combinations gcc
             , gl_je_sources gjs
             , gl_je_batches gjb
             , (SELECT 'EMPRESA' id_sgm
                     , a.flex_value cd_sgm
                     , b.description de_sgm
                     , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                             , 'L', 'Passivo'
                             , 'A', 'Ativo'
                             , 'E', 'Despesa'
                             , 'O', 'Pat.Liq'
                             , 'R', 'Receita')
                         tp_sgm
                  FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                 WHERE a.flex_value_set_id = 1015197
                   AND a.flex_value_id = b.flex_value_id
                   AND b.language = 'PTB') emp
             , ( SELECT 'CONTA' id_sgm
                       , a.flex_value cd_sgm
                       , b.description de_sgm
                       , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                               , 'L', 'Passivo'
                               , 'A', 'Ativo'
                               , 'E', 'Despesa'
                               , 'O', 'Pat.Liq'
                               , 'R', 'Receita')
                           tp_sgm
                    FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                   WHERE a.flex_value_set_id = 1015237
                     AND a.flex_value_id = b.flex_value_id
                     AND b.language = 'PTB') cta
             , fnd_user fus
         WHERE gjl.je_header_id = gjh.je_header_id
           AND gjb.je_batch_id = gjh.je_batch_id
           AND gjs.je_source_name = gjh.je_source
           AND gjh.ledger_id = 2041 -- p_nr_livro
           AND gjh.actual_flag = 'A'
           AND gjh.period_name = upper('null') -- 'JAN-14'
           AND gcc.code_combination_id = gjl.code_combination_id
           AND gcc.segment1 IN ('01', '12', '13', '14', '05', '16', '18')
           AND emp.id_sgm = 'EMPRESA'
           AND emp.cd_sgm = gcc.segment1
           AND cta.id_sgm = 'CONTA'
           AND cta.cd_sgm = gcc.segment2
           AND fus.user_id = gjb.last_updated_by
          AND rownum<1001;
          
      CURSOR c2
      IS
        SELECT /*+
             INDEX(GCC GL_CODE_COMBINATIONS_U1)
             INDEX(GJB GL_JE_BATCHES_U1)
             INDEX(FUS FND_USER_U1)
             INDEX(GJL GL_JE_LINES_U1)*/
                    (lpad(TO_CHAR (NVL (SUM(gjl.accounted_dr), 0),'999G999G999G999G999G990D00'),268,' ')) /*VL_DEBITO*/
             ||' '||(lpad(TO_CHAR (NVL (SUM(gjl.accounted_cr), 0),'999G999G999G999G999G990D00'),37 ,' ')) /*VL_CREDITO*/
             ||' '|| TO_CHAR (COUNT (*)) soma /*qtd_reg*/
          FROM gl_je_lines gjl
             , gl_je_headers gjh
             , gl_code_combinations gcc
             , gl_je_sources gjs
             , gl_je_batches gjb
             , (SELECT 'EMPRESA' id_sgm
                     , a.flex_value cd_sgm
                     , b.description de_sgm
                     , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                             , 'L', 'Passivo'
                             , 'A', 'Ativo'
                             , 'E', 'Despesa'
                             , 'O', 'Pat.Liq'
                             , 'R', 'Receita')
                         tp_sgm
                  FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                 WHERE a.flex_value_set_id = 1015197
                   AND a.flex_value_id = b.flex_value_id
                   AND b.language = 'PTB') emp
             , ( SELECT 'CONTA' id_sgm
                       , a.flex_value cd_sgm
                       , b.description de_sgm
                       , DECODE (SUBSTR (a.compiled_value_attributes, 5, 1)
                               , 'L', 'Passivo'
                               , 'A', 'Ativo'
                               , 'E', 'Despesa'
                               , 'O', 'Pat.Liq'
                               , 'R', 'Receita')
                           tp_sgm
                    FROM fnd_flex_values_vl a, fnd_flex_values_tl b
                   WHERE a.flex_value_set_id = 1015237
                     AND a.flex_value_id = b.flex_value_id
                     AND b.language = 'PTB') cta
             , fnd_user fus
         WHERE gjl.je_header_id = gjh.je_header_id
           AND gjb.je_batch_id = gjh.je_batch_id
           AND gjs.je_source_name = gjh.je_source
           AND gjh.ledger_id = 2041
           AND gjh.actual_flag = 'A'
           AND gjh.period_name = 'null' -- 'JAN-14'
           AND gcc.code_combination_id = gjl.code_combination_id
           AND gcc.segment1 IN ('01', '12', '13', '14', '05', '16', '18')
           AND emp.id_sgm = 'EMPRESA'
           AND emp.cd_sgm = gcc.segment1
           AND cta.id_sgm = 'CONTA'
           AND cta.cd_sgm = gcc.segment2
           AND fus.user_id = gjb.last_updated_by
           
           and rownum<1001;
      w_ind_erro     NUMBER;
      w_erro_geral   EXCEPTION;
    
    
      w_msg_erro     VARCHAR2 (240);
      w_linha        VARCHAR2 (1000);
    
    
      w_nm_arq_utl   UTL_FILE.file_type;
      w_nm_arq_utl_r UTL_FILE.file_type;
    
    
      w_nm_dir_dad   VARCHAR2 (80);
      --w_nm_int_dir_dad VARCHAR2 (80);
      --w_nm_arq_dad   VARCHAR2 (80);
      w_nm_arq_dad_aux VARCHAR2 (80);
      w_nm_arq_dad_qtd VARCHAR2 (80);
      
      P_DIRETORIO VARCHAR2(200) := '/tmp';
      P_ARQUIVO   VARCHAR2(200) := 'Desliga_mainframe_indices_economicos.csv';
      
      W_DIRETORIO VARCHAR2(50) := P_DIRETORIO;
      W_ARQUIVO   VARCHAR2(50) := P_ARQUIVO;
    
    
      w_qtd_reg      NUMBER;
    
    
      -- -----------------------------------------------
    
      PROCEDURE pr_abre_txt --(p_nm_dir IN VARCHAR2, p_nm_arq IN VARCHAR2, p_tp_abertura IN VARCHAR2)
      IS
      BEGIN
        w_nm_arq_utl := UTL_FILE.fopen ( W_DIRETORIO, W_ARQUIVO, 'W');
      EXCEPTION
        WHEN UTL_FILE.invalid_path THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Caminho Invalido');
        WHEN UTL_FILE.invalid_mode THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Modo Invalido');
        WHEN UTL_FILE.invalid_filehandle THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Nome Arquivo Invalido');
        WHEN UTL_FILE.invalid_operation THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Operacao Invalida');
        WHEN UTL_FILE.read_error THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Erro Leitura');
        WHEN UTL_FILE.write_error THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Erro Escrita');
        WHEN UTL_FILE.internal_error THEN
          UTL_FILE.fclose (w_nm_arq_utl);
          raise_application_error (-20504, 'ERRO NA ABERTURA DO ARQUIVO: Erro Interno');
      END pr_abre_txt;
    
    
      -- ------------------------------------------------------
      PROCEDURE pr_grava_txt (p_de_msg IN VARCHAR2)
      IS
      BEGIN
        UTL_FILE.put_line (w_nm_arq_utl, p_de_msg);
      EXCEPTION
        WHEN UTL_FILE.invalid_path THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Caminho Invalido');
        WHEN UTL_FILE.invalid_mode THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Modo Invalido');
        WHEN UTL_FILE.invalid_filehandle THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Nome Arquivo Invalido');
        WHEN UTL_FILE.invalid_operation THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Operacao Invalida');
        WHEN UTL_FILE.read_error THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Erro Leitura');
        WHEN UTL_FILE.write_error THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Erro Escrita');
        WHEN UTL_FILE.internal_error THEN
          raise_application_error (-20503, 'ERRO AO GRAVAR: Erro Interno');
      END pr_grava_txt;
    
    
      -- ------------------------------------------------------
      PROCEDURE pr_fecha_txt
      IS
      BEGIN
        UTL_FILE.fclose (w_nm_arq_utl);
      EXCEPTION
        WHEN OTHERS THEN
          raise_application_error (-20501, 'ERRO NO FECHAMENTO ARQUIVO DE LOG');
      END pr_fecha_txt;
      -- --------------------------------------------------------------------------------------------------
      BEGIN
      --PR_ABRE_TXT (W_NM_DIR_SQL, W_NM_ARQ_DAD ,'w');
      pr_abre_txt ( W_DIRETORIO, W_ARQUIVO, 'w');
    
    
      w_nm_arq_utl_r := UTL_FILE.fopen ( w_nm_arq_utl, w_nm_arq_dad_qtd, 'w');
     -- w_qtd_reg   := 0;
    
    
     /* FOR cur2 IN c2
      LOOP
        w_linha     := cur2.soma;
        pr_grava_txt (w_linha);
    
    
        w_qtd_reg   := w_qtd_reg + 1;
    
    
        --IF MOD (w_qtd_reg, 100000) = 0 THEN
          UTL_FILE.put_line (w_nm_arq_utl_r, 'Qtd. de linhas geradas = ' w_qtd_reg w_linha );
        --END IF;
      END LOOP;
    
    
     -- UTL_FILE.put_line (w_nm_arq_utl_r, 'Final de Qtd. de linhas geradas = ' || w_qtd_reg);
      UTL_FILE.fclose (w_nm_arq_utl_r);
      --*/
      -- --------------------------------------------------------------------------------------------------
      pr_fecha_txt;
      --
      -- --------------------------------------------------------------------------------------------------
    
    
    
    
    
    
    EXCEPTION
      WHEN w_erro_geral THEN
        raise_application_error (-20501, 'Parada por motivo de Erros na execução.');
    --
    END XXTVGAUDIT;
    

    Oracle Directory object is not OS directory. It is a definition saying Oracle which OS directory to use. When Oracle run

    v_file: = UTL_FILE.fopen ('TMP_DIR', 'output.log', 'W');

    He goes to the data dictionary and:

    1. it checks the Oracle directory object exists tmp_dir

    2. If the Oracle user is allowed to create files on this object directory Oracle (see WRITING privilege granted I posted)

    3 reflects the object of Oracle TMP_DIR for OS directory/tmp directory

    4 creates the file /tmp/output.og owned by OS oracle user with the appropriate permissions on the database server (assuming that OS directory Oracle Directory object points on exists and oracle OS user can create files there).

    Remember, most of the time the OS Oracle user created files permissions are such that the 'others' can even read.

    SY.

  • Call a jscript vbscript script and return a value

    Hello world

    I'm trying to simplify a tedious task: every day I have to fill in an InDesign document with 48 different numbers that go into 48 blocks of text. I would like to write a script to get these numbers (the temperatures that I get in an excel file) automatically and write them in the corresponding text blocks.

    So basically I use jscript to implement a document. So I want him to call a vbscript script (since only vbscript can retrieve an excel cell value) and have it return the value to the jscript in a variable.

    So far I managed to adapt a .vbs script that retrieves the number of the cell and the poster in a box:

    Option Explicit
    Dim objApp, objWbs, objWorkbook, objSheet

    Set objApp = New
    Set objWbs = objApp.WorkBooks
    objApp.Visible = False
    Set objWorkbook = objWbs.Open ("C:\Temperature")
    Set objSheet = objWorkbook.Sheets ("Sheet1")

    MsgBox objSheet.Range ("C5"). Value

    objWorkbook.Close False
    objWbs.Close
    objApp.Quit

    ObjSheet = Nothing set
    Set objWorkbook = Nothing
    Set objWbs = Nothing
    Set objApp = Nothing

    But it is only that. I always have trouble with:

    (1) the order doScript: How can I call the jscript vbscript script?

    (2) writes the value retrieved (or table) in a variable in vbscript script

    The rest is easy: in the jscript, write the table in the corresponding text blocks.

    Hope someone can help me. Thank you very much

    Maphio M.

    When you place an Excel file in InDesign, it becomes a table. From there on, it's a simple as myFrame.tables [0] .cells [x] .silence (myFrame being a reference to the image that you placed the Excel file in).

  • Open a new File() by Script and set the Type of PDF file fails...

    Hi all

    I created a script to download PDFs from a server and store them in an Indesign Document. Everything works fine except Indesign doesn't not recocnize file Type when you try to place the pdf file and get an error that the downloaded PDF file cannot be due to the filter of the unknown.

    This is because the file type is apparently set to TEXT (creator is CARO) event if I write the file with

    myFile.open ('w', 'PDF', "CARO");

    No idea how

    -get Indesign all the file type of a file newly generated in PDF format

    or

    -Change the Type of file later

    or

    -tell Indesign what filter to use when you place this file?

    Thanks for your help

    BTW: Indesign CS5 (7.0.4), OS X 10.6.8

    UH... but you might be better off placing both '\0\0\0\0' and leave the treatment kick file extension.

  • Windows Media PLayer 11, removes all libraries and playlists. Message about corrupted files.

    This happens about once a day when I stopped WMP, but this does not happen everytime I stop WMP.  WMP loses all elements of library and playlists.  I can add my music to the library, and WMP recognizes the music and my playlists.  But at some point, it will be lost again. I am using WIndows XP Pro SP3.  Any ideas how to solve this problem?

    Thank you!

    What is the exact text of the message about corrupted files?

    This is usually caused by a corrupt media library. To reset the library, follow the instructions for WMP 11 on XP at http://zachd.com/pss/pss.html#medialibrary. Note the reset of the library will make you lose all the counts to play and possibly ratings too.

  • Collect the Thread Dump using Script and live in the separate log file

    Legends of dear,

    I ask you to provide me with a few lines of useful guide to collect the Thread Dump using script on linux and redirect the output to a separate log file, but not the STDOUT file. If it is redirect to STDOUT then how to extract only the thread stack to a separate log file.

    I used
    ps - ef | grep java
    kill - 3 < pid > > > ss1_td.log

    but it does not provide the thread stack to the log file.

    Any aid operation would be appreciated a lot.

    Kind regards
    Knockaert

    Karthik,

    Please see this link below

    http://www.industryvertical.co.in/2013/01/script-thread-dump-of-multiple-servers.html

    site of my friend where we placed a hands-on experience.

    Mark this if useful for you

    Kind regards

    Bouchra Arun.

  • How spool out put of several scripts and get a single spool output file

    Hello

    I have a master script that calls three other scripts. The three scripts produce their own files of spooling. But I would like to have the master script also produce a single output (in addition to the release of three individual, I mean). How to do this? Can you please help.
    Following are the scripts:
    --m.sql (master script)
    spool c:\m.log
    @1.sql
    @2.sql
    @3.sql
    spool off
    
    --1.sql
    spool c:\1.log
    insert into test values(1);
    commit;
    spool off
    --2.sql
    spool c:\2.log
    insert into test values(2);
    commit;
    spool off
    
    spool c:\3.log
    insert into test values(3);
    commit;
    spool off
    
    --table used
    SQL> desc test
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     A                                                  NUMBER
    When I run the above script m.sql it does not produce the other 3 log files (1.log, 2.log etc.), but m.log (which is master log file which should have output of each of the three call script) is an empty file with 0 bytes!

    Thank you

    Published by: orausern on May 1st, 2011 03:17

    Try this:

    sqlplus uid/pwd  @m.sql >AllSpools.log
    

    PS: Add a statement of 'exit' at the end of the main script.

    : p

  • How can I return results based on 2 columns?

    I have had a problem and it cannot know for life. First of all, here is a series of example data that I use so you can see exactly what I'm asking.

    EmplId Effdt Effseq            

    10001 1 JANUARY 99 ' 0

    10001 1 JULY 11 ' 0

    10001 1 JULY 11 ' 1

    10001 1 JULY 11 ' 2

    10001 1 JULY 12 ' 3

    Do I have to do here is get 3 ranks. 3 rows, I need are lines 1, 4 and 5. I need rank 1 because it's a different date. I need line 5 for the same reason: it is another date. The question arises with how I can get the rank 4. The problem is that the lines 2, 3, 4, and all have the same date (effdt) effective, Developer SQL just returned one of these lines. Because these 3 rows all have the same date (effdt) effective the switch becomes the actual sequence number (effseq). When the date (effdt) effective is the same, you enter the maximum number of sequence (effseq) effective and return results of this whole line as the emplid, effdt and effseq. It seems so simple and something that you can use a subquery for, but its not as simple as that. Note, that you can specifically use the emplid = 10001 in any specific form because there are many employee also id, the lines will not be in a specific order so that you can always just grasp the lines 1, 4 and 5. Some employees may have only a single line in the database, and some may have 50 lines. Everything depends only on the combination of employee id (emplid) date (effdt) efficient and effective sequence (effseq) as the tiebreaker. Any help to fix this would be greatly appreciated. Thank you in advance.

    WITH t
         AS (SELECT 10001 emplid,
                    TO_DATE ('01-JAN-1999', 'dd-mon-yy') effdt,
                    0 effseq
               FROM DUAL
             UNION ALL
             SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 0 FROM DUAL
             UNION ALL
             SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 1 FROM DUAL
             UNION ALL
             SELECT 10001, TO_DATE ('01-JUL-2011', 'dd-mon-yy'), 2 FROM DUAL
             UNION ALL
             SELECT 10001, TO_DATE ('01-JUL-2012', 'dd-mon-yy'), 3 FROM DUAL)
    SELECT emplid, effdt, effseq
      FROM (SELECT t.*,
                   ROW_NUMBER ()
                      OVER (PARTITION BY emplid, effdt ORDER BY effseq DESC)
                      rn
              FROM t)
     WHERE rn = 1
    
    EMPLID EFFDT EFFSEQ
    10001
    01/01/1999
    0
    10001
    01/07/2011
    2
    10001
    01/07/2012
    3
  • SQLPLUS: How generate a txt file Gohan the command

    I am generating a text file with these commands in sqlplus:

    Column chave_acesso format a46
    Dt_alt format a10 column
    set pagesize 100
    coil arquivo.txt
    Select chave_acesso, dt_alt tab

    Everything is perfect, except for 1 small detail.
    The command 'select chave_acesso, dt_alt from the tab' appears in the txt file...
    Is it possible to eliminate it?

    Eduardo

    Hi, Eduardo,

    Are you a person running SQL thse commands * quicker (manually or in the past), or you are using a SQL * more script?

    COIL puts a copy of everything that appears on your screen (or seems, in the case of OFF SET TERMOUT) in a file. If the SELECT command is entered to a SQL > prompt, so it's that appear on your screen and thus be put in the HOLD file. Put all the commands in a file (let's call it foo.sql) and it's in c:\my_app\some_folder) and run it by saying:

    @c:\my_app\some_folder\foo
    
  • create and write input by the user in a txt file

    Hey all

    Below, I added a piece of code... I would like to take the data and store it in a txt file as soon as the user clicks on the button field, I tried several times to get this figured out and google it fot too long now. could someone be so kind to help me please?

    Thank you

    btnRegister = new ButtonField ("Register", ButtonField.CONSUME_CLICK);

    customListener = new FieldChangeListener() {}
    ' Public Sub fieldChanged (field field, int context) {}
    Dialog.Alert ("you will receive an email as soon as your account has been activated!");
    }
    };
    Add (btnRegister);
    btnRegister.setChangeListener (customListener);
    }
    store users entry in a txt file, if no txt file, then create one.
    {} public void createFile()
    System.out.println ("registry"); Screen prints
    String data = Username.getText ();
    String Data1 = enterPIN.getText ();
    data from Byte [] = "Registration".getBytes ();
    try {}
    FileConnection fconn is (FileConnection) Connector.open (NewRegFileName, Connector.READ_WRITE);.
    If (fconn.exists ()) {}
    fconn. Delete();
    fconn. Create();
    System.out.println ("created txtfile");
    OutputStream os = fconn.openOutputStream ();
    System.out.println ("write data");
    OS. Write (Data);
    OS. Close();
    fconn. Close();
    }
    }
    catch (IOException e) {}
    System.out.println ("NewRegFileName" + (Data));
    }

    System.exit(); Quit the application after registration
    }
    Screen.onClose ();
    / * public boolean onClose() {//Exit application after registration
    System.Exit (0);
    Returns true;
    }*/
    Screen.Close (); Quit the application after registration
    }

    When you call createFile()?

  • Execute and return a value (or object) from another script

    I wish I could have some of the functions of the little that I often use in my scripts, just like seporate scripts. so I can then update in one place and do not copy in every script, I want to use them in.

    I don't know if this is possible at all. But I'd love to be able to just call them and return of their share values somehow.

    for example

    Swatches of color key code, I need:

            var inCutColorCMYK = cmykColor(50, 0, 100, 0);
            var intCutSPOT = makeSwatch("CutIN", inCutColorCMYK);
    

    so I have these functions I have tweeked/found:

       function makeSwatch( swName, swCol) {  
        var doc = app.activeDocument;
        var sel = doc.selection;
        if (!inCollection(doc.swatches, swName)) {  
        var aSwatch = doc.spots.add();  
        aSwatch.name = swName;  
        aSwatch.color = swCol;  
        aSwatch.tint = 100;  
        aSwatch.colorType = ColorModel.SPOT;  
        var aSwatchSpot = new SpotColor();  
        aSwatchSpot.spot = aSwatch;  
        return aSwatchSpot;  
        }else{  
            return doc.swatches.getByName(swName);  
            }  
        };
    
    
    function cmykColor(c, m, y, k) {  
        var newCMYK = new CMYKColor();  
        newCMYK.cyan = c;  
        newCMYK.magenta = m;  
        newCMYK.yellow = y;  
        newCMYK.black = k;  
        return newCMYK;  
        };
    
    
    
    
    function inCollection(collection, nameString) {  
           var exists = false;  
       try{
        for (var i = 0; i < collection.length; i++) {  
            if (collection[i].name == nameString) {  
                exists = true;  
                }  
            }  
        }catch(e){//alert("Illustrator needs drop kicked!!\nPlease restart Illustrator :/\n\n"+e)
            }
            return exists;  
            
          };
    

    in any case! I keep finding my self using functions like that again and again new scripts and hope there is a way to do this!

    Any help is appreciated!

    -Boyd

    You have the file a.jsx, something like myLibrary.jsx, and in it, you can have all the functions for future use. In the file, it can look like this:

    ------------------------------------ Library file -----------------------------------

    #target illustrator

    function MyLibrary() {}

    this.cmykColor = function (c, m, y, k) {}

    var newCMYK = new CMYKColor();

    newCMYK.cyan = c;

    newCMYK.magenta = m;

    newCMYK.yellow = y;

    newCMYK.black = k;

    Return newCMYK;

    };

    function applyFillColorTo (item, color) {}

    item.fillColor = color;

    }

    function CataloguedPathItem (pathItem) {}

    var p = pathItem;

    p.applyFillColor = {function (color)}

    applyFillColorTo (this, color);

    };

    return p;

    }

    this.cataloguedPathItem = {function (pathItem)}

    var p = new CataloguedPathItem (pathItem);

    return p;

    }

    };

    ----------------------------------------------------------------------------------------

    And then you can understand and use this file in other scripts, like here:
    -------------------------------------- Script File ---------------------------------

    #target illustrator

    #include 'C:\\Users\\Me\\Desktop\\My Adobe Scripts\\Illustrator\\MyLibrary.jsx.

    function test() {}

    var MyLib = new MyLibrary(); the script library is used as an object - elements of its scope of application are available through point (.) as mylib.myFunction ();

    If (app.documents.length > 0) {}

    var doc = app.activeDocument;

    If (doc.selection.length > 0) {}

    var MonElement = mylib.cataloguedPathItem(doc.selection[0]);

    var mylib.cmykColor (0,100,50,0) = myColor;

    myItem.applyFillColor (myColor);

    }

    } else {}

    Alert ("there is no open document.");

    }

    }

    test();

    ----------------------------------------------------------------------------------------

    The colors test script just a pathItem, but it uses functions from the inside of the object of 'library' to power the process. Note that to use the library of color a path implied instantiate this path as a custom which is a 'applyFillColor' method that uses a function of the scope of the library (called "applyFillColorTo") for power. Then, we can not simply the function "applyFillColorTo" use within the scope of the Script file because it is protected by the MyLibrary object.

  • Path to script and automate the vmkfstools command?

    Very long story short, running vSphere 5, I need a way to execute the command 'vmkfstools y 60' against my stores of data to recover free space on my table of Compellent SAN.

    This article explains the command and the object: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US & cmd = displayKC & externalId = 2014849

    From one or more hosts, I so need to go into each VMFS data store and run the command "vmkfstools y XX" to reclaim space. Otherwise the Compellent table see SVMotion jobs and snapshots as "new entries" and never release the free space.

    To automate this, I would use PowerCLI and maybe just run the script as a scheduled my vSphere Server task.

    I understand also the VMA device can do this kind of stuff, but I don't understand how to automate/schedule tasks with it more I prefer using PowerCLI.

    Anyway, sorry for the question noob and thanks in advance. Any help is very appreciated!

    The problem is we use thin Volumes put into service on a Board of 3par, with T10 off Unmap (which is now the default) freeing up space by deleting a virtual machine or by a storage vmotion means space gets released to the VMWare/data store layer and can be reused by Vpshere but he is not recovered at the Array level , delivering a vmkfstools, writes a file in the data store removes it returns T10Unmap to the matrix, the 3par then and returns this space to the free pool. It works when we manually we just want until VMWare decide UNMAP turn automate it.

    Brett

Maybe you are looking for