Sei sulla pagina 1di 2

RHEL 6 new features part I: Upstart | www.codarama.

com

RHEL 6 new features part I: Upstart


With RHEL6 having been released last November, half a year of aging has given me the opportunity to let some of its new features sink in. Definitely my 2 favorites are the introduction of upstart, to replace the aging Sysv init startup mechanism, and the introduction of advanced resource management with Cgroups. Upstart has been available in Ubuntu since the release of edgy in 2006, and soon after it got picked up by other distributions as well. Upstart is an event-driven init daemon. As a consequence, unlike the previous requirement of having multiple runlevels, with each service defined to start in a particular sequence, Upstart will only start a service if there is an external event requiring it. i.e. It will only start Bluetooth services if there is Bluetooth hardware detected. This has the benefit that a large part of the service configuration is handled automatically and since only necessary services will run, you will have faster startup times and less resource consumption. Upstart still regards a change in runlevel as an event, so most services will still use their old rc style init scripts. As a consequence you can still use chkconfig to control these startup scripts or use the service command to manipulate these services. But for other functionalities, like setting up serial console, you will have to use an upstart job instead of the old way of doing it through inittab. One good example is when you want to setup a serial console for qemu if you are testing rhel6 in a KVM virtual machine. By default the upstart script /etc/init/serial.conf will start a serial console if the primary console in grub is set to a serial console. If you want a serial console that is not the primary console, you will have to create your own upstart script: [root@localhost ~]# cat /etc/init/Stty.conf stop on runlevel [016] start on runlevel [345] respawn instance /dev/ttyS0 exec /sbin/mingetty /dev/ttyS0 The first 2 lines of the script are called the event definition. Upstart needs to now for each service defined in /etc/init, what event will trigger a change in the state of the service. In this case we tell upstart to start the service in runlevels 3, 4 and 5 and to stop the service in runlevel 0, 1 and 6 The rest of the script is what is called the process definition. Here you define what to run and how to run it. In this case we tell upstart to respawn the getty process if it dies, to ensure that there is only one instance running that uses /dev/ttyS0 and we specify the getty command to run. Now that weve create the upstart service we can manipulate it with the initctl tool: [root@localhost ~]# initctl start Stty [root@localhost ~]# initctl status Stty Stty (/dev/ttyS0) start/running, process 18425 Now that we have a serial console running we can connect to it on the hardware node: [:root@somehost:/root]$ virsh list Id Name State ---------------------------------2 test running [:root@somehost:/root]$ virsh console 2 The version of upstart in RHEL 6 lacks some of the more recent features introduced in Ubuntu like the ability to schedule cron like jobs and a replacement for inetd with the socket upstart event. I hope these are backported to RHEL 6 soon.

Add new comment


http://www.codarama.com/drupal/?q=node/6[2/1/2012 2:34:38 PM]

RHEL 6 new features part I: Upstart | www.codarama.com

Your name

Subject

Comment *

More information about text formats

Text format

Filtered HTML Filtered HTML

Web page addresses and e-mail addresses turn into links automatically. Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> Lines and paragraphs break automatically.

By submitting this form, you accept the Mollom privacy policy.

Save Preview

http://www.codarama.com/drupal/?q=node/6[2/1/2012 2:34:38 PM]

Potrebbero piacerti anche