25

Job with external program Linux script -> "Can't exec external program (...

 1 year ago
source link: https://answers.sap.com/questions/13833550/job-with-external-program-linux-script-cant-exec-e.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
yesterday

Job with external program Linux script -> "Can't exec external program (13)" or (2). Means?

28 Views

I don't have a clear question, it's more about having an open discussion, especially with Linux and Basis people.

I had an issue which I could solve, but I don't know what means the error codes, I don't get information about the status codes.

I started a job which runs a very simple "hello world" external program (program = path to the shell script).

In the job log, I see (French, sorry):

Texte message                                                         Classe message  Nº message  Type message
Le job a été lancé.                                                         00           516           S
Etape 001 lancée                                                            BT           611           S
Programme externe : /tmpbatch/XXXXXXXXXXXXXXXXXXXXX/echo_hello_world        BT           612           S
Paramètre affecté :                                                         BT           613           S
Programme externe : Can't exec external program (13)                        BT           606           S
Programme externe : External program terminated with exit code 1            BT           606           S
Programme externe interrompu                                                BT           614           A
Job interrompu                                                              00           518           Aa

but I don't know what means the error code 13.
How to know?If I start the job with the trace activated, in the dev_cp developer trace, I see:

Trace file of control program
trace level = 3
< Function: BtcTrcInit> Function: main  SAPXPG Unicode Version
2023-03-03--14-30-06 : After BtcXpgDetach and RfcStartServer
2023-03-03--14-30-06 : RfcStartServer returned OK
Begin of check_if_security_list
security check switched OFF
End of check_if_security_list
Begin of check_trace_option
End of check_trace_option
Begin of open_protocol_file
protocol for commands switched off !
  Install RFC call SAPXPG_START_XPG
  Install RFC call SAPXPG_START_XPG_LONG
  Install RFC call SAPXPG_END_XPG
  Wait for RFC call SAPXPG_START_XPG or SAPXPG_START_XPG_LONG
2023-03-03--14-30-06 : RfcListenAndDispatch
Start of: OnAuthorizationCheck
  logon_check: rfc_attr.user = DDIC
  logon_check: rfc_attr.client = 100
  logon_check: function (from secAttr) = SAPXPG_START_XPG_LONG
  logon_check: partner_type = 3
  > Function: BtcXpgStartXpgLong
2023-03-03--14-30-06 : Beginning of BtcXpgStartXpgLong
BtcXpgStartXpgLong: special_trace_flag = <6>
    > Function: BtcXpgStartXpgInt
      > Function: BtcXpgItTransfer
        Content of source log table:
          Line  Text
          <No StdOut/StdErr output reported>
        Target log table is not identical to source
      < Function: BtcXpgItTransfer
      > Function: BtcTrcReset
      < Function: BtcTrcReset
      Call mode: VIA RFC
      Input arguments of BtcXpgStartXpg:
        External program: /tmpbatch/XXXXXXXXXXXXXXXXXXXXXXX/echo_hello_world
      tracecntl = : 6
      Display of Parameter string switched off !!
        Contents of control flags:
          StdIn control flag: redirect StdIn
          StdOut control flag: store StdOut output in memory
          StdErr control flag: store StdErr output in memory
          Trace control flag: unknown contents
          Termination control flag: control program will wait for termination
      > Function: BtcXpgCheck
        > Function: BtcXpgArgv
          Total number of arguments scanned: 0
          Argument argv[0]: echo_hello_world
        < Function: BtcXpgArgv
      < Function: BtcXpgCheck
      > Function: BtcXpgSigInst
        set signal handler for SIGCHLD to SIG_DFL
        old signal handler for SIGCHLD: SIG_DFL
      < Function: BtcXpgSigInst
      > Function: BtcXpgStart
        > Function: BtcTrcInit
        Process id: 32021
        Parent process id: 52119
      < Function: BtcXpgStart
      Start status of external program: external program successfully started
      Id of external process: 0000032023
      StdOut/StdErr collected in memory
        Line  Text
        <No StdOut/StdErr output reported>
    < Function: BtcXpgStartXpgInt
2023-03-03--14-30-06 : End of BtcXpgStartXpgLong
  < Function: BtcXpgStartXpgLong
2023-03-03--14-30-06 : After first call of RfcListenAndDispatch
  Wait for RFC call SAPXPG_END_XPG
2023-03-03--14-30-06 : Before second call of RfcListenAndDispatch
Start of: OnAuthorizationCheck
  logon_check: rfc_attr.user = DDIC
  logon_check: rfc_attr.client = 100
  logon_check: function (from secAttr) = SAPXPG_END_XPG
  logon_check: partner_type = 3
  > Function: BtcXpgEndXpg
2023-03-03--14-30-06 : Beginning of BtcXpgEndXpg
    > Function: BtcXpgEndXpgInt
      > Function: BtcXpgItTransfer
        Content of source log table:
          Line  Text
          <No StdOut/StdErr output reported>
        Target log table is not identical to source
      < Function: BtcXpgItTransfer
      > Function: BtcXpgReadChild
        Output of external command not written to log !!
        Process executing external program has terminated
      < Function: BtcXpgReadChild
      > Function: BtcXpgEnd
      < Function: BtcXpgEnd
      Termination status of external program: program terminated with error code 1
      StdOut/StdErr collected in memory
    < Function: BtcXpgEndXpgInt
2023-03-03--14-30-06 : End of BtcXpgEndXpg
  < Function: BtcXpgEndXpg
2023-03-03--14-30-06 : After second call of RfcListenAndDispatch
2023-03-03--14-30-06 : After call of RfcCloseConnection (wait)
< Function: main
2023-03-03--14-30-06 : End of SAPXPG: main<br>

If I run it using program "sh" and additional parameter is the path to the shell script, then the program seems to start and I then get a better job log:

Texte message                                                         Classe message  Nº message  Type message
Le job a été lancé.                                                         00           516           S
Etape 001 lancée                                                            BT           611           S
Programme externe : sh                                                      BT           612           S
Paramètre affecté : /tmpbatch/XXXXXXXXXXXXXXXXXXXXX/echo_hello_world        BT           613           S
Programme externe : hello world                                             BT           606           S
Job terminé                                                                 BT           607           S
Job terminé                                                                 00           517           S

and dev_cp contains:

Trace file of control program
trace level = 3
< Function: BtcTrcInit
> Function: main  SAPXPG Unicode Version
2023-03-03--11-09-17 : After BtcXpgDetach and RfcStartServer
2023-03-03--11-09-17 : RfcStartServer returned OK
Begin of check_if_security_list
  security check switched OFF
End of check_if_security_list
Begin of check_trace_option
End of check_trace_option
Begin of open_protocol_file
protocol for commands switched off !
  Install RFC call SAPXPG_START_XPG
  Install RFC call SAPXPG_START_XPG_LONG
  Install RFC call SAPXPG_END_XPG
  Wait for RFC call SAPXPG_START_XPG or SAPXPG_START_XPG_LONG
2023-03-03--11-09-17 : RfcListenAndDispatch
Start of: OnAuthorizationCheck
  logon_check: rfc_attr.user = DDIC
  logon_check: rfc_attr.client = 100
  logon_check: function (from secAttr) = SAPXPG_START_XPG_LONG
  logon_check: partner_type = 3
  > Function: BtcXpgStartXpgLong
2023-03-03--11-09-17 : Beginning of BtcXpgStartXpgLong
    BtcXpgStartXpgLong: special_trace_flag = <6>
    > Function: BtcXpgStartXpgInt
      > Function: BtcXpgItTransfer
        Content of source log table:
          Line  Text
          <No StdOut/StdErr output reported>
        Target log table is not identical to source
      < Function: BtcXpgItTransfer
      > Function: BtcTrcReset
      < Function: BtcTrcReset
      Call mode: VIA RFC
      Input arguments of BtcXpgStartXpg:
        External program: sh
      tracecntl = : 6
      Display of Parameter string switched off !!
        Contents of control flags:
          StdIn control flag: redirect StdIn
          StdOut control flag: store StdOut output in memory
          StdErr control flag: store StdErr output in memory
          Trace control flag: unknown contents
          Termination control flag: control program will wait for termination
      > Function: BtcXpgCheck
        > Function: BtcXpgArgv
          parameter number 1:
          Total number of arguments scanned: 1
          Argument argv[0]: sh
        < Function: BtcXpgArgv
      < Function: BtcXpgCheck
      > Function: BtcXpgSigInst
        set signal handler for SIGCHLD to SIG_DFL
        old signal handler for SIGCHLD: SIG_DFL
      < Function: BtcXpgSigInst
      > Function: BtcXpgStart
        Process id: 63921
        Parent process id: 52121
      < Function: BtcXpgStart
      Start status of external program: external program successfully started
      Id of external process: 0000063922
      StdOut/StdErr collected in memory
        Line  Text
        <No StdOut/StdErr output reported>
    < Function: BtcXpgStartXpgInt
2023-03-03--11-09-17 : End of BtcXpgStartXpgLong
  < Function: BtcXpgStartXpgLong
2023-03-03--11-09-17 : After first call of RfcListenAndDispatch
  Wait for RFC call SAPXPG_END_XPG
2023-03-03--11-09-17 : Before second call of RfcListenAndDispatch
        > Function: BtcTrcInit
Start of: OnAuthorizationCheck
  logon_check: rfc_attr.user = DDIC
  logon_check: rfc_attr.client = 100
  logon_check: function (from secAttr) = SAPXPG_END_XPG
  logon_check: partner_type = 3
  > Function: BtcXpgEndXpg
2023-03-03--11-09-17 : Beginning of BtcXpgEndXpg
    > Function: BtcXpgEndXpgInt
      > Function: BtcXpgItTransfer
        Content of source log table:
          Line  Text
          <No StdOut/StdErr output reported>
        Target log table is not identical to source
      < Function: BtcXpgItTransfer
      > Function: BtcXpgReadChild
        Output of external command not written to log !!
        Process executing external program has terminated
      < Function: BtcXpgReadChild
      > Function: BtcXpgEnd
      < Function: BtcXpgEnd
      Termination status of external program: no errors reported
      StdOut/StdErr collected in memory
    < Function: BtcXpgEndXpgInt
2023-03-03--11-09-17 : End of BtcXpgEndXpg
  < Function: BtcXpgEndXpg
2023-03-03--11-09-17 : After second call of RfcListenAndDispatch
2023-03-03--11-09-17 : After call of RfcCloseConnection (wait)
< Function: main
2023-03-03--11-09-17 : End of SAPXPG: main

How is it possible to get more information about what's going on, what means error code 13? (or 2 when the script doesn't exist). I missed authorization to run commands via SM49, could it be related? (note that authorization trace doesn't return any issue)

Is there nothing that we can do to get some information if the error comes from running the script directly versus running it via "sh"?

Note that in another system with same software components, I could get meaningful texts without need to run "sh", so I guess that it's all about the configuration of Linux users.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK