Roberto Gonzalez Azevedo
2006-Sep-13 23:26 UTC
[Xen-users] Run a script after creating a domain
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Is it possible to run a script after creating a domain ? e.g. xm create -c /etc/xen/auto/domain ... after this, execute a script. e.g. /etc/xen/scripts/myscript.sh ... Any ideas ? Thanks. - -- - ---------------------------- Roberto Gonzalez Azevedo -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFCJO/F+EMwkXLsEwRAht+AJ9MXX9DCXHuBYgNTVDq3ZBtwTRM9gCfWNRv sWoxqfc5Cn87dVLr2aH/gJw=v+Kw -----END PGP SIGNATURE----- _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tom Z. Napierala
2006-Sep-14 10:47 UTC
Re: [Xen-users] Run a script after creating a domain
Dnia Thursday 14 September 2006 00:26, Roberto Gonzalez Azevedo napisaĆ:> Is it possible to run a script after creating a domain ? > e.g. > xm create -c /etc/xen/auto/domain > ... > after this, execute a script. > e.g. > /etc/xen/scripts/myscript.sh > ... > > > Any ideas ?You can use xen-tools package (http://xen-tools.org/software/xen-tools/). Excellent tool, you can run several hooks after creating domain, there are also "roles" you can assign to the dom during creation. Regards, -- Tom Napierala DB Alliance Limited North Point House, New Mallow Road, Cork, Ireland The National Software Centre, Mahon, Cork, Ireland _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Thu, Sep 14, 2006 at 11:47:51AM +0100, Tom Z. Napierala wrote:> Dnia Thursday 14 September 2006 00:26, Roberto Gonzalez Azevedo napisa??: > > Is it possible to run a script after creating a domain ? > > e.g. > > xm create -c /etc/xen/auto/domain > > ... > > after this, execute a script. > > e.g. > > /etc/xen/scripts/myscript.sh > > ... > > > > > > Any ideas ? > > You can use xen-tools package (http://xen-tools.org/software/xen-tools/). > Excellent tool, you can run several hooks after creating domain, there are > also "roles" you can assign to the dom during creation.I think the OP was more interested in running a script after the new domain had started - rather than after it had been created for the first time. My solution would be to right a shell script: #!/bin/sh # /usr/local/bin/start-vm # if [ -z "${1}" ]; then echo "Usage: $0 domain; fi xm create ${1} if [ -x /etc/xen/${1}.sh ]; then /etc/xen/${1}.sh fi That will run "domain.sh" after starting "domain". Steve -- Debian GNU/Linux System Administration http://www.debian-administration.org/ _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Roberto Gonzalez Azevedo
2006-Sep-14 11:56 UTC
Re: [Xen-users] Run a script after creating a domain
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 "> I think the OP was more interested in running a script after the > new domain had started - rather than after it had been created for > the first time" Yes that''s it, but I want to start it at system boot. Ubuntu starts all VM''s which configuration files located in /etc/xen/auto. I just want something automatic, rather than to initialize every VM in /etc/rc.local, but also thanks for the tip. - ---------------------------- Roberto Gonzalez Azevedo Steve Kemp wrote:> On Thu, Sep 14, 2006 at 11:47:51AM +0100, Tom Z. Napierala wrote: >> Dnia Thursday 14 September 2006 00:26, Roberto Gonzalez Azevedo napisa??: >>> Is it possible to run a script after creating a domain ? >>> e.g. >>> xm create -c /etc/xen/auto/domain >>> ... >>> after this, execute a script. >>> e.g. >>> /etc/xen/scripts/myscript.sh >>> ... >>> >>> >>> Any ideas ? >> You can use xen-tools package (http://xen-tools.org/software/xen-tools/). >> Excellent tool, you can run several hooks after creating domain, there are >> also "roles" you can assign to the dom during creation. > > I think the OP was more interested in running a script after the > new domain had started - rather than after it had been created for > the first time. > > My solution would be to right a shell script: > > #!/bin/sh > # /usr/local/bin/start-vm > # > if [ -z "${1}" ]; then echo "Usage: $0 domain; fi > > xm create ${1} > if [ -x /etc/xen/${1}.sh ]; then > /etc/xen/${1}.sh > fi > > That will run "domain.sh" after starting "domain". > > Steve-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFFCUNhF+EMwkXLsEwRAnqXAJsGp8Qdx6f6bp8if7TqLbDIV+tleQCfdBh4 5upReIxIcr3K3NU5D4PvhbU=2Qhx -----END PGP SIGNATURE----- _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On 9/14/06, Roberto Gonzalez Azevedo <rgonzalez@censanet.com.br> wrote:> [...] > Is it possible to run a script after creating a domain ?Xen runs the network-script defined in the configuration. Although you might not doing network-based stuff and so it might be misleading to do other things there, you could append the start of your script onto the network script. Another way would be to let the domain''s config file run a script with a python syscall at the end (have it not exactly in my mind how this should be done, so no example, sorry) of the config file, as config files are only python scripts. Henning _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On 9/14/06, Roberto Gonzalez Azevedo <rgonzalez@censanet.com.br> wrote:> > I think the OP was more interested in running a script after the > > new domain had started - rather than after it had been created for > > the first time > Yes that''s it, but I want to start it at system boot.Sorry, didn''t see that reply. I think then the solutions provided in my other post should work - they don''t use an additional external wrapper. BTW: I think it''s vif-script, not network-script, the latter is only run at xend''s start. Henning _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Hello,> Another way would be to let the domain''s config file run a script with > a python syscall at the end (have it not exactly in my mind how this > should be done, so no example, sorry) of the config file, as config > files are only python scripts.Unfortunately that will only work at domain creation time. That means, the skript will not run if the domain is simply rebooted without destroying the domain. I ran into a similar problem while trying to make the scheduler parameters persistent (there is no config file parameter for that matter in 3.0.2). Until now i did not find any suitable way to solve that problem. Greetings, -timo On Thu, 14 Sep 2006 14:37:32 +0200, "Henning Sprang" <henning_sprang@gmx.de> wrote:> On 9/14/06, Roberto Gonzalez Azevedo <rgonzalez@censanet.com.br> wrote: >> [...] >> Is it possible to run a script after creating a domain ? > > Xen runs the network-script defined in the configuration. > > Although you might not doing network-based stuff and so it might be > misleading to do other things there, you could append the start of > your script onto the network script. > > > Henning > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users-- Timo Benk - Jabber ID: fry@jabber.org - ICQ ID: #241877854 PGP Public Key: http://m28s01.vlinux.de/timo_benk_gpg_key.asc _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tom Z. Napierala
2006-Sep-14 15:02 UTC
Re: [Xen-users] Run a script after creating a domain
[...]> I think the OP was more interested in running a script after the > new domain had started - rather than after it had been created for > the first time.You''re absolutely right, I misunderstood the question> My solution would be to right a shell script: > > #!/bin/sh > # /usr/local/bin/start-vm > # > if [ -z "${1}" ]; then echo "Usage: $0 domain; fi > > xm create ${1} > if [ -x /etc/xen/${1}.sh ]; then > /etc/xen/${1}.sh > fi > > That will run "domain.sh" after starting "domain".Thank''s for the snippet, very handy. BTW. Big thanks for your tools David. I didn''t have chance to say "thanks" before, so here you have ;) Regards, -- Tom Napierala DB Alliance Limited North Point House, New Mallow Road, Cork, Ireland The National Software Centre, Mahon, Cork, Ireland _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Tom Z. Napierala
2006-Sep-14 15:39 UTC
Re: [Xen-users] Run a script after creating a domain
> BTW. Big thanks for your tools David. I didn''t have chance to say "thanks" > before, so here you have ;)Damn, I meant Steve. I was on the phone with David while writing. Obviously I have to get more sleep. -- Tom Napierala DB Alliance Limited North Point House, New Mallow Road, Cork, Ireland The National Software Centre, Mahon, Cork, Ireland _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users