Output from ;run script after server creation

6 posts / 0 new
Last post
#1 Tue, 11/18/2008 - 09:56
tbirnseth

Output from ;run script after server creation

Is there any way to have the output of a script displayed as part of the info displayed at server creation? It seems to not be captured. It would be helpful to know that it ran successfully or not.<br><br>Post edited by: tbirnseth, at: 2008/11/20 07:48

Tue, 11/18/2008 - 12:56
Joe
Joe's picture

Currently, no - the output from the post-creation script is not displayed.

However, in the next Virtualmin release, I will have it shown if the script fails (exits with a non-zero status). That should allow you to report any error messages if you like..

--

Check out the forum guidelines!

Tue, 11/18/2008 - 13:22 (Reply to #2)
tbirnseth

Can I propose a different option/solution?

Agree with the error output (though that could be a work around for reporting the info).

But how about allowing me to send output to a program through a pipe?

It would be nice for me to be able to give status of installation of my ASP application along with the other installation information.

If the script exits non-zero, is there any side effect to the server's creation?

tony

Tue, 11/18/2008 - 13:45 (Reply to #3)
Joe
Joe's picture

If the post-creation script outputs non-zero, there will be no effect on the virtual server creation, as it has already completed.

I don't quite follow what you mean by sending output to the program via a pipe though? What output, and which program?

--

Check out the forum guidelines!

Tue, 11/18/2008 - 13:58 (Reply to #4)
tbirnseth

I completely understand your not wanting to just dump random script output to the screen (would be messy for non-attentive scripts).

I was thinking that if you had a some kind of interface that would allow 'desired output' to be displayed, it would help.

For instance, lets say I have post_sample.sh that runs on server creation... If I could do something in that script like:
echo $desired_output | some_hook
at the end of the script, then '$desired_output' could be displayed on the screen.

Complete output captured from 'sample.sh' would be displayed on non-zero exit. But if a zero exit occured and something had been fed to 'some_hook' then that output would be displayed to the screen.

In my case, $desired_output might consist of:
&quot;Configuring cart...
done
&quot;
Whereas the script might output other stuff due to sub-programs not being run in 'quiet mode' or other noise.

Does this make sense? Or maybe the easiest way is to simply display what comes to stderr whether the script succeeds or not.

Tue, 11/18/2008 - 14:53 (Reply to #5)
Joe
Joe's picture

I think that if you want this level of control over output, the best bet would be to write your own Virtualmin feature plugin .. that way you can display anything you want at setup time. See : http://www.virtualmin.com/documentation/id,writing_virtualmin_plugins/

--

Check out the forum guidelines!

Topic locked