[opensuse] running a script at end of boot with systemd
Hello, I need to launch virtual machines at the end of the server's boot; I can do it manually ("VBoxHeadless -startvm s-r", s-r is the virtual machine name) But I want to: * start the virtual machine automatically * close the machine gracefully on shutdown (UPS warning) with inits, I have a "boot.last", but now I'm on openSUSE 12.1 with systemd and I don't know anymore - it's not really "a service" - I beg. any link or hint? thanks jdd -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 31/12/2011 09:27, jdd a écrit :
any link or hint?
I just forgot to say that I want the virtual machine be launched as the user "virtual", not root thanks jdd -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 12/31/2011 05:34 PM, jdd wrote:
Le 31/12/2011 09:27, jdd a écrit :
any link or hint?
I just forgot to say that I want the virtual machine be launched as the user "virtual", not root
The commands you want to execute at start would seem to go in /etc/init.d/boot.local. In /etc/systemd/system you see.... default.target -> /lib/systemd/system/runlevel5.target /lib/systemd/system/runlevel5.target -> graphical.target a cat of graphical.target shows (in part) Requires=multi-user.target In the directory multi-user.target.wants you see... rc-local.service which contains..... # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. [Unit] Description=/etc/init.d/boot.local Compatibility ConditionFileIsExecutable=/etc/init.d/boot.local [Service] Type=oneshot ExecStart=/etc/init.d/boot.local TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Sat, 31 Dec 2011 10:34:18 +0100 jdd <jdd@dodin.org> wrote:
Le 31/12/2011 09:27, jdd a écrit :
any link or hint?
I just forgot to say that I want the virtual machine be launched as the user "virtual", not root
thanks jdd
While studying systemd vs Upstart the last couple of days I dug up a couple of interesting and informative links that you might find helpful: <http://forums.opensuse.org/english/other-forums/community-fun/general-chit-chat/455359-why-systemd-not-upstart.html> <http://patrakov.blogspot.com/2011/01/writing-systemd-service-files.html> Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Carl Hartung said the following on 12/31/2011 09:06 AM:
While studying systemd vs Upstart the last couple of days I dug up a couple of interesting and informative links that you might find helpful:
What I found interesting in that is this statement: <quote> This simplification occurs because service files specify what should be done, not how it should be done. I.e., unlike initscripts, they follow the declarative style and are not programs. </quote> In the past, sysadmins had to be programmers. Now its getting to be about configuration management. -- There are still places where people think that the function of the media is to supply information -- Donn Rottenburg -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
jdd wrote:
with inits, I have a "boot.last", but now I'm on openSUSE 12.1 with systemd and I don't know anymore - it's not really "a service" - I beg.
This is one of the "features" of systemd and why I reverted back to system v. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 31/12/11 05:27, jdd wrote:
Hello,
I need to launch virtual machines at the end of the server's boot;
There is no reliable way to do what you want, the old init system had a SUSE specific specific $ALL target, this does not exist in systemd, and probably never will. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 31/12/2011 18:50, Cristian Rodríguez a écrit :
On 31/12/11 05:27, jdd wrote:
Hello,
I need to launch virtual machines at the end of the server's boot;
There is no reliable way to do what you want, the old init system had a SUSE specific specific $ALL target, this does not exist in systemd, and probably never will.
I see a vboxes init, beginning with:/ # chkconfig: - 91 35 # description: Starts and stops vbox autostart VMs. # Based on # http://www.amiryan.org/2009/11/04/virtualbox-init-d-service-autostart-script... # # By Richard Bos <rbos at opensuse dot org> - May 2010 I never noticed it before (dated may 2010), but seems to do what I need but is it wise to use init script in this time of systemd migration? It's also unusefully complicated for my simple needs. I know what is installed, so no need to check, I think VirtualBox only need network and I would like to run it as the user "virtual", "sudo virtual && command" should work I yet have to look for a shutdown similar command, but I'm pretty sure there is one thanks jdd -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 31/12/11 17:12, jdd wrote:
Le 31/12/2011 18:50, Cristian Rodríguez a écrit :
On 31/12/11 05:27, jdd wrote:
Hello,
I need to launch virtual machines at the end of the server's boot;
There is no reliable way to do what you want, the old init system had a SUSE specific specific $ALL target, this does not exist in systemd, and probably never will.
You probably need vboxtool to be installed. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Le 31/12/2011 23:24, Cristian Rodríguez a écrit :
You probably need vboxtool to be installed.
seems pretty much what I need, thanks http://vboxtool.sourceforge.net/ jdd -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On Saturday 31 Dec 2011 09:27:56 jdd wrote:
Hello,
I need to launch virtual machines at the end of the server's boot;
I can do it manually ("VBoxHeadless -startvm s-r", s-r is the virtual machine name)
But I want to:
* start the virtual machine automatically * close the machine gracefully on shutdown (UPS warning)
with inits, I have a "boot.last", but now I'm on openSUSE 12.1 with systemd and I don't know anymore - it's not really "a service" - I beg.
any link or hint?
thanks jdd
Jean-Daniel, If there no existing unit file for vbox, perhaps you might create one with the options you feel are appropropriate and submit back to factory. I think the systemd.unit man page covers most of what you might need. joyeux Réveillon, Graham -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (7)
-
Anton Aylward
-
Carl Hartung
-
Cristian Rodríguez
-
Ed Greshko
-
Graham Anderson
-
James Knott
-
jdd