Stackscripts - how to debug ?

Hi, maybe I'm missing something but how to debug a stackscript ? There are only a few informations about stackscripts and it seems I'm missing something here. I tried to deploy a stackscript but it is unclear how to see the flow of the script.

Thank you.

3 Replies

Most stack scripts contain bash functions, if we take http://www.linode.com/stackscripts/view … criptID=10">http://www.linode.com/stackscripts/view/?StackScriptID=10 for example after the include statement which adds http://www.linode.com/stackscripts/view … ScriptID=1">http://www.linode.com/stackscripts/view/?StackScriptID=1 into the top of the script, it runs system_update which does the following

function system_update {
    apt-get update
    apt-get -y install aptitude
    aptitude -y full-upgrade
}

I personally like to add set -e at the top of my stack scripts to make sure they fail on error. You can copy a stack script and add that to the top if you like.

I'm not sure you got an answer to the original question, which was how to go about debugging a StackScript. I have the same question, but given the age of this message it may require starting a new thread.

EDIT:

I guess you got the best answer. Open the Lish console and rebuild the Linode using the StackScript. You can see the process and get an idea of where it stops.

I just ran into this and have a fix that works for me and might help others.

 #!/bin/bash -e
 exec > >(tee -i /var/log/stackscript.log)
Top of StackScript with output logging
  1. Create instance with the StackScript changes above.
  2. Once the console shows "Running"
  3. Launch Console
  4. Glish
  5. Login as root
  6. tail -f /var/log/stackscript.log

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct