jobs starting a bg script with nohup and/or &

884 views
Skip to first unread message

Andrew Steady

unread,
Mar 16, 2013, 5:42:13 PM3/16/13
to rundeck...@googlegroups.com
Hi,

I'm trying to start background job on a server via rundeck. The bg job will stop the n/w and cause the rundeck connection to be lost.

If I start like this: "sudo nohup <myscript-which-stops-the-n/w-and-does-stuff>" then my script does not run.

If I do this: "sudo nohup <myscript-which-stops-the-n/w-and-does-stuff> &" the job executes but rundeck reports that the job step has failed.

I can't do an "|| true" because the network has gone by the time that would execute.
I can't do a "true ||" because the job needs sudo and the sudo keyword needs to be at the start of the script.

Anyone know how I could get this to work?

Many thanks,

Andy

Greg Schueler

unread,
Mar 18, 2013, 1:48:38 PM3/18/13
to rundeck...@googlegroups.com
Hi Andrew,

In Rundeck 1.5 you can attach an error handler to a workflow step.  If the handler is successful then your workflow could continue without failure if that's what you want.  You could also use the result of the failed step to make this conditional.  See http://rundeck.org/docs/manual/job-workflows.html#error-handlers

As well, if your remote node is now offline, you can use a new Step plugin included with Rundeck 1.5 called "Local Execution".  This way the error handler command executes locally (on the Rundeck server) rather than attempting to dispatch the handler command to the remote node.



--
You received this message because you are subscribed to the Google Groups "rundeck-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rundeck-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Andrew Steady

unread,
Mar 19, 2013, 5:11:14 AM3/19/13
to rundeck...@googlegroups.com
Hi,

Thanks Greg, unfortunately I have not been able to upgrade to 1.5 yet.

If I try the project archive import I get:

2013-03-19 08:17:11,733 [1843455568@qtp-1295986757-3] ERROR org.hibernate.AssertionFailure - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: null id in rundeck.ScheduledExecution entry (don't flush the Session after an exception occurs)

I have tried removing the offending xml from the .jar but then others fail and I can't see a pattern.
I have tried adding a description to each and every job as I saw reference to that in another post.

If I try to just import the jobs using rd-jobs load I get:

2013-03-19 08:48:37,787 [main] ERROR com.dtolabs.clien t.utils.WebserviceHttpClientChannel - Unable to parse result document: Error on line 3 of document  : The markup in the document following the root element must be well-formed. Nested exception: The markup in the document following the root element must be well-formed.
org.dom4j.DocumentException: Error on line 3 of document  : The markup in the document following the root element must be well-formed. Nested exception: The markup in the document following the root element must be well-formed.
        at org.dom4j.io.SAXReader.read(SAXReader.java:482)
        at org.dom4j.io.SAXReader.read(SAXReader.java:343)
        at com.dtolabs.client.utils.WebserviceHttpClientChannel.postMakeRequest(WebserviceHttpClientChannel.java:283)
        at com.dtolabs.client.utils.HttpClientChannel.makeRequest(HttpClientChannel.java:396)
        at com.dtolabs.client.services.ServerService.makeRundeckRequest(ServerService.java:196)
        at com.dtolabs.client.services.ServerService.makeRundeckRequest(ServerService.java:142)
        at com.dtolabs.client.services.ServerService.makeRundeckRequest(ServerService.java:98)
        at com.dtolabs.client.services.RundeckAPICentralDispatcher.loadJobs(RundeckAPICentralDispatcher.java:1477)
        at com.dtolabs.rundeck.core.cli.jobs.JobsTool.loadAction(JobsTool.java:659)
        at com.dtolabs.rundeck.core.cli.jobs.JobsTool.go(JobsTool.java:626)
        at com.dtolabs.rundeck.core.cli.BaseTool.run(BaseTool.java:107)
        at com.dtolabs.rundeck.core.cli.jobs.JobsTool.main(JobsTool.java:364)
Nested exception:
org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 4490; The markup in the document following the root element must be well-formed.

I tried to debug what might be wrong in the xml but not much luck, best I can think is its the cdata around the embedded script jobs' content.

This post looked on the same track but had no resolution: https://groups.google.com/forum/?fromgroups=#!searchin/rundeck-discuss/org.dom4j.DocumentException:$20Error$20on$20line$203$20of$20document$20/rundeck-discuss/1awwg1VgD0o/qulaDNl42CkJ

Thanks,

Andy


--
You received this message because you are subscribed to a topic in the Google Groups "rundeck-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rundeck-discuss/qAiR6RVKGOY/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to rundeck-discu...@googlegroups.com.

Andrew Steady

unread,
Mar 19, 2013, 6:13:38 AM3/19/13
to rundeck...@googlegroups.com
Hi,

The jobs which would not load are ones with either a very long description or a very long default value for an option.

The description length is easy to work-around, the default value one not so easy, but I guess not impossible.

Cheers,

Andy

Greg Schueler

unread,
Mar 19, 2013, 12:33:49 PM3/19/13
to rundeck...@googlegroups.com
Hi Andrew,

The issue with too long option descriptions has been seen before, logged here: https://github.com/dtolabs/rundeck/issues/320

so it looks like there are additional fields with the same problem

Andrew Steady

unread,
Mar 19, 2013, 4:39:19 PM3/19/13
to rundeck...@googlegroups.com
Hi,

OK thanks - I got all my jobs in and the local error handler is working for the scenario I originally asked about - thank you.

I notice that if I delete an option from a job and save the job, the job is not updated with the option's removal. Sometimes if I set the option to be "not required" that updates, but sometimes even that does not update.

I did a quick search in the forum but did not find any reference to this issue.

Is anyone else facing it?

Andy

Greg Schueler

unread,
Mar 25, 2013, 2:29:14 PM3/25/13
to rundeck...@googlegroups.com
Hi Andrew,

that sounds like a bug, do you mind filing it?

Andrew Steady

unread,
Mar 25, 2013, 6:40:09 PM3/25/13
to rundeck...@googlegroups.com
Hi Greg,

I have created the issue here: https://github.com/dtolabs/rundeck/issues/336

It seems to be limited to jobs imported from 1.4.

Cheers,

Andy
Reply all
Reply to author
Forward
0 new messages