Reduce Linux boot-time by lazy-loading development-specific services

I’m very anal when it comes to boot time. When I power up my laptop, I want it to be available for me ASAP. As a developer this sometimes conflicts with the need of having a lot of daemons running: PostgreSQL, MySQL, Apache, Memcache, Redis, Solr, etc etc. Services that are needed when i work on different projects. All these daemons takes time to start up, and since I don’t always program, I don’t always need them. But still they start up, and still I have to wait.

So I solved this by disabling the services in the /etc/rc.* folders. And instead I made this little script, which I put into $HOME/bin (which of course is already in your $PATH, right?)


# Must run as root
if [ $(id -u) != "0" ]
    sudo "$0" "$@"
    exit $?

service apache2 $1
service postgresql $1
service mysql  $1

It automatically ask for your sudo password, and then either starts or stops your daemons depending on the parameter, that you supply.

Skriv et svar

Din e-mailadresse vil ikke blive publiceret. Krævede felter er markeret med *