A recent entry to planetemacsen reminded me of a wiki entry added a good while
back which complements, or even supercedes, other methods of starting the emacs
daemon. There are a lot of solutions for running the emacs daemon when not
already running and/or using the emacsclient. I find the following solution
most convenient since there is no need to specifically start the server yourself
at any stage - it makes use of the alternate-editor option. Create a small
script and place it somewhere on your path.
exec emacsclient --alternate-editor="" -c "$@"
The ="" is the key. This tells the emacsclient code to start the daemon and then
call itself if its not already running.
The wiki entry tells you more and describes the use of the EDITOR env variable.
My Emacs Files At GitHub