The `sh` step in a Jenkins Pipeline uses `nohup` to launch the script on the 
agent in such a way that Jenkins can restart while the `sh` step is running 
without interrupting the script’s execution.

Is the `nohup` command available on NonStop/Tandem machines? If so, is it 
reachable from the agent’s PATH? What is the result of `which nohup` on the 
agent? (For me on OS X the result is /usr/bin/nohup, and /usr/bin is on my 
PATH.)

> On Sep 25, 2018, at 11:36, Meg Watson <watso...@gmail.com> wrote:
> 
> Hi,
> 
> I'm a newbie to pipelines.  I have a Jenkins master running on Linux (RHEL), 
> and I have an agent running (via SSH) on a NonStop/Tandem machine, which 
> looks like UNIX for all intents and purposes.  I can run various jobs on the 
> NonStop agent without issue, build steps with shell commands work fine.  
> 
> However,  when I use an "sh ..." command in a pipeline script, it fails with 
> an error about "can't find nohup...".
> 
> Any suggestions?  I even went as far as to create a symlink to nohup in the 
> /home/hp/meg/remote_jenkins/workspace/Ermiyas3 directory.  No dice.
> 
> Here is the pipeline script:
> 
> pipeline {
>     agent { node { label 'MEG' } }
>     environment {
>         PATH = 
> '/bin:/usr/coreutils/bin:.:/home/hp/meg/bin:/usr/local/bin:/usr/tandem/java/bin:/usr/local/maven/bin'
>     }
>     stages {
>         stage('Build') {
>             steps {
>                 echo 'Building..'
>                 echo 'env.PATH=' + env.PATH
>                 sh 'ls'
>             }
>         }
>         stage('Test') {
>             steps {
>                 input 'Click to execute TEST'
>                 echo 'Testing..'
>                 sh 'mvn test'
>             }
>         }
>         stage('Deploy') {
>             steps {
>                 input 'Click to execute DEPLOY'
>                 echo 'Deploying....'
>             }
>         }
>     }
> }
> 
> Here is the log:
> 
> Started by user mwatson <http://bmc053.atc-hp.com:16877/user/mwatson>
> Running in Durability level: MAX_SURVIVABILITY
> [Pipeline] node
> Running on TSEK_MEG <http://bmc053.atc-hp.com:16877/computer/TSEK_MEG/> in 
> /home/hp/meg/remote_jenkins/workspace/Ermiyas3
> [Pipeline] {
> [Pipeline] withEnv
> [Pipeline] {
> [Pipeline] stage
> [Pipeline] { (Build)
> [Pipeline] echo
> Building..
> [Pipeline] echo
> env.PATH=/bin:/usr/coreutils/bin:.:/home/hp/meg/bin:/usr/local/bin:/usr/tandem/java/bin:/usr/local/maven/bin
> [Pipeline] sh
> [Ermiyas3] Running shell script
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] stage
> [Pipeline] { (Test)
> Stage "Test" skipped due to earlier failure(s)
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] stage
> [Pipeline] { (Deploy)
> Stage "Deploy" skipped due to earlier failure(s)
> [Pipeline] }
> [Pipeline] // stage
> [Pipeline] }
> [Pipeline] // withEnv
> [Pipeline] }
> [Pipeline] // node
> [Pipeline] End of Pipeline
> java.io.IOException: error=4002, No such file or directory
>       at java.lang.UNIXProcess.forkAndExec(Native Method)
>       at java.lang.UNIXProcess.<init>(UNIXProcess.java:251)
>       at java.lang.ProcessImpl.start(ProcessImpl.java:134)
>       at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
> Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to TSEK_MEG
>               at 
> hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741)
>               at 
> hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
>               at hudson.remoting.Channel.call(Channel.java:955)
>               at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1052)
>               at hudson.Launcher$ProcStarter.start(Launcher.java:449)
>               at 
> org.jenkinsci.plugins.durabletask.BourneShellScript.launchWithCookie(BourneShellScript.java:186)
>               at 
> org.jenkinsci.plugins.durabletask.FileMonitoringTask.launch(FileMonitoringTask.java:71)
>               at 
> org.jenkinsci.plugins.workflow.steps.durable_task.DurableTaskStep$Execution.start(DurableTaskStep.java:176)
>               at 
> org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:229)
>               at 
> org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:153)
>               at 
> org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
>               at sun.reflect.GeneratedMethodAccessor907.invoke(Unknown Source)
>               at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>               at java.lang.reflect.Method.invoke(Method.java:498)
>               at 
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
>               at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
>               at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
>               at 
> groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
>               at 
> org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
>               at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
>               at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
>               at 
> org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157)
>               at 
> org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
>               at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:133)
>               at 
> org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
>               at 
> org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
>               at 
> org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:129)
>               at 
> com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
>               at 
> com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
>               at 
> com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
>               at 
> com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
>               at sun.reflect.GeneratedMethodAccessor821.invoke(Unknown Source)
>               at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>               at java.lang.reflect.Method.invoke(Method.java:498)
>               at 
> com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
>               at 
> com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
>               at com.cloudbees.groovy.cps.Next.step(Next.java:83)
>               at 
> com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
>               at 
> com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
>               at 
> org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
>               at 
> org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
>               at 
> com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
>               at 
> org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34)
>               at 
> org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59)
>               at 
> org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
>               at 
> org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58)
>               at 
> org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
>               at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:332)
>               at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83)
>               at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244)
>               at 
> org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232)
>               at 
> org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64)
>               at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>               at 
> hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
>               at 
> jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
>               at 
> jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
>               at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> Caused: java.io.IOException: Cannot run program "nohup" (in directory 
> "/home/hp/meg/remote_jenkins/workspace/Ermiyas3"): error=4002, No such file 
> or directory
>       at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
>       at hudson.Proc$LocalProc.<init>(Proc.java:249)
>       at hudson.Proc$LocalProc.<init>(Proc.java:218)
>       at hudson.Launcher$LocalLauncher.launch(Launcher.java:929)
>       at hudson.Launcher$ProcStarter.start(Launcher.java:449)
>       at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1299)
>       at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1259)
>       at hudson.remoting.UserRequest.perform(UserRequest.java:212)
>       at hudson.remoting.UserRequest.perform(UserRequest.java:54)
>       at hudson.remoting.Request$2.run(Request.java:369)
>       at 
> hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
>       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>       at java.lang.Thread.run(Thread.java:748)
> Finished: FAILURE
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-users+unsubscr...@googlegroups.com 
> <mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/fb15a0dd-1d11-4057-9300-ac8dfe94faf1%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/fb15a0dd-1d11-4057-9300-ac8dfe94faf1%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/44194A28-ED24-4F66-B2D4-8048D8D7424C%40cloudbees.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to