You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Di Li <os...@gmail.com> on 2018/03/23 15:45:32 UTC

Re: how to exec shell script and output its log

and this is after you had tried the *logoutput *flag in Execute(... ?

On Fri, Mar 23, 2018 at 6:49 AM, <xi...@sky-data.cn> wrote:

> Hi!
>
> I have some shell scripts and want to call them in service python scripts.
>
> I saw an example which use Execute to call shell script like
> Execute("/path/do_something").
>
> But i notice that if the log level is INFO, the shekllscript own log can
> not be printed, only change log
> level to DEBUG can show log.
>
> Is there a better way to call shell script and print its log?
>

Re: how to exec shell script and output its log

Posted by Nate Cole <nc...@hortonworks.com>.
If your invoked script fails (in general, returns non-zero code) then you can raise an exception.  That will get propagated to the backend as a failure.

Thanks,
Nate

On 3/25/18, 9:32 PM, "Dai Xiang" <xi...@sky-data.cn> wrote:

    On Fri, Mar 23, 2018 at 11:45:32AM -0400, Di Li wrote:
    > and this is after you had tried the *logoutput *flag in Execute(... ?
    
    Thanks very much!
    
    Also, i want to call script in the install step, if the script run
    failed, install still show success in the web, how does ambari judge
    success or fail? How can i make ambari know the failure of script mean
    install fail?
    
    > 
    > On Fri, Mar 23, 2018 at 6:49 AM, <xi...@sky-data.cn> wrote:
    > 
    > > Hi!
    > >
    > > I have some shell scripts and want to call them in service python scripts.
    > >
    > > I saw an example which use Execute to call shell script like
    > > Execute("/path/do_something").
    > >
    > > But i notice that if the log level is INFO, the shekllscript own log can
    > > not be printed, only change log
    > > level to DEBUG can show log.
    > >
    > > Is there a better way to call shell script and print its log?
    > >
    
    -- 
    Best Regards
    Dai Xiang
    
    


Re: how to exec shell script and output its log

Posted by Dai Xiang <xi...@sky-data.cn>.
On Fri, Mar 23, 2018 at 11:45:32AM -0400, Di Li wrote:
> and this is after you had tried the *logoutput *flag in Execute(... ?

Thanks very much!

Also, i want to call script in the install step, if the script run
failed, install still show success in the web, how does ambari judge
success or fail? How can i make ambari know the failure of script mean
install fail?

> 
> On Fri, Mar 23, 2018 at 6:49 AM, <xi...@sky-data.cn> wrote:
> 
> > Hi!
> >
> > I have some shell scripts and want to call them in service python scripts.
> >
> > I saw an example which use Execute to call shell script like
> > Execute("/path/do_something").
> >
> > But i notice that if the log level is INFO, the shekllscript own log can
> > not be printed, only change log
> > level to DEBUG can show log.
> >
> > Is there a better way to call shell script and print its log?
> >

-- 
Best Regards
Dai Xiang