The Gluster Blog

Gluster blog stories provide high-level spotlights on our users all over the world

CentOS 6 upstart overrides: How to make something happen before something else

Gluster
2013-07-01

I have generic users that are logged in automatically since they’re not allowed user prefs anyway, and it would be more of a hindrance in their environment.

I use puppet to manage a staging directory that has the home directory as I want it to be, and use tmpfs for the user’s actual $HOME. In order for this to work, the staged default home needs to be copied onto the tmpfs mount before Xwindows starts.

All this means that I can’t do it in rc.local as that’s run simultaneous to the prefdm upstart job, creating a race condition.

To resolve the problem, I learned about upstart override configuration. It turns out you can create a <jobname>.override and override any stanza in the packaged upstart job configuration. In my case I created the following:

/etc/prefdm.override

# homedir - sets up the home directory of the auto-logged-in user
#

pre-start script
	/usr/bin/puppet agent --onetime --no-daemonize >/var/log/prestart.log
	/usr/bin/rsync -av /home/thinguest.orig/ /home/thinguest/ >>/var/log/prestart.log
	/sbin/restorecon -rv /home/thinguest >> /var/log/prestart.log
end script

This overrides the non-existent pre-start stanza in prefdm.conf with that script, ensuring those things are done before /etc/X11/prefdm -nodaemon is executed.

This is actually true, of course, for all the EL6 based distros, and also is true for Ubuntu/Debian.

BLOG

  • 06 Dec 2020
    Looking back at 2020 – with g...

    2020 has not been a year we would have been able to predict. With a worldwide pandemic and lives thrown out of gear, as we head into 2021, we are thankful that our community and project continued to receive new developers, users and make small gains. For that and a...

    Read more
  • 27 Apr 2020
    Update from the team

    It has been a while since we provided an update to the Gluster community. Across the world various nations, states and localities have put together sets of guidelines around shelter-in-place and quarantine. We request our community members to stay safe, to care for their loved ones, to continue to be...

    Read more
  • 03 Feb 2020
    Building a longer term focus for Gl...

    The initial rounds of conversation around the planning of content for release 8 has helped the project identify one key thing – the need to stagger out features and enhancements over multiple releases. Thus, while release 8 is unlikely to be feature heavy as previous releases, it will be the...

    Read more