Job file question.

Sandeep Puddupakkam (spuddupa) spuddupa at cisco.com
Thu Sep 17 01:45:33 BST 2009


Hi,

 

Using upstart 0.5.

 

I have a job file like this. File blah does not exist.

[172:/etc/init/jobs.d]$ cat test

console output

script

   echo "Starting here..."

   val=$(ls blah)

   echo This line is not being printed.. ls returned $? Val=$val

end script

 

In the sample above `ls blah` returns 1 and this is being shown as the
termination code of test.

/var/log/messages prints this

Sep 16 00:28:34 172 <1253060914,577989>init: test main process (10355)
terminated with status 1

 

However when I run the same stuff using a shell script I see this output

[172:/etc/init/jobs.d]$ /root/test.sh

Starting here...

ls: blah: No such file or directory

This line is not being printed.. ls returned 1 Val=

 

So my questions.

1) Why is the output different when I run stuff using a job file vs a
script.

2) How do I make sure my job continues to run even if there is a
failure.

 

I have tried this in my job file to get around this issue. However is
there a better way?

 

[172:/etc/init/jobs.d]$ cat test1

console output

script

   echo "Starting here..."

   if val=$(ls blah); then

      echo "exit status: $?"

   fi

   echo "came past exit."

end script

 

[172:/etc/init/jobs.d]$ start test1

[172:/etc/init/jobs.d]$ Starting here...

ls: blah: No such file or directory

came past exit.

 

I am using ls to illustrate my problem. My actual job file calls
inotifywait ...

I am testing this using upstart 0.5.

 

Thanks,

Sandeep

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/upstart-devel/attachments/20090916/a69d4858/attachment-0001.htm 


More information about the upstart-devel mailing list