Starting bliss automatically - Debian, Ubuntu and Upstart
I've been wanting to write some notes up about 'daemonizing' your bliss process for a while. I've already written about using Windows services to start bliss on startup. Now it's the turn for Ubuntu, Debian and any other Linux distro that uses the Upstart mechanism.
I'll start with a disclaimer: a daemon can mean different things to different people. For my purposes I simply mean a background process that is started at boot time and stopped when the computer is shutdown.
Upstart makes creating a daemon really easy. All that needs to be done is the creation of a configuration file in a special directory on your filesystem. This directory is
/etc/init. Go take a look at it now... here's what mine looked like before I create the daemon:
gravelld@vm-ubuntu-server:~$ ls /etc/init apport.conf mounted-dev.conf setvtrgb.conf atd.conf mounted-proc.conf ssh.conf console-setup.conf mounted-run.conf tty1.conf control-alt-delete.conf mounted-tmp.conf tty2.conf cron.conf mounted-var.conf tty3.conf dbus.conf networking.conf tty4.conf dmesg.conf network-interface.conf tty5.conf failsafe.conf network-interface-security.conf tty6.conf friendly-recovery.conf plymouth.conf udev.conf hostname.conf plymouth-log.conf udev-fallback-graphics.conf hwclock.conf plymouth-splash.conf udev-finish.conf hwclock-save.conf plymouth-stop.conf udevmonitor.conf irqbalance.conf plymouth-upstart-bridge.conf udevtrigger.conf module-init-tools.conf procps.conf ufw.conf mountall.conf rc.conf upstart-socket-bridge.conf mountall-net.conf rcS.conf upstart-udev-bridge.conf mountall-reboot.conf rc-sysinit.conf ureadahead.conf mountall-shell.conf rsyslog.conf ureadahead-other.conf mounted-debugfs.conf screen-cleanup.conf wait-for-state.conf
To create the daemon, we add a new
.conf file in
/etc/init. Here's the configuration file I am using at the moment:
# bliss - music file organiser # description "Start bliss" start on startup script sh /opt/bliss/bin/bliss.sh end script
To configure this to your own ends, edit the
sh /opt/bliss/bin/bliss.sh line and change the path to point to your own bliss installation, if necessary. Now, save this to
Believe it or not, that's all you need to do to configure the daemon! You can check on the status of bliss straight away:
gravelld@vm-ubuntu-server:~$ status bliss bliss stop/waiting
Starting the bliss daemon is simple, but make sure you do it as root:
gravelld@vm-ubuntu-server:~$ sudo start bliss bliss start/running, process 1803
Now, let's just track back to our configuration file. The line
start on startup was included. This is what tells Upstart to start bliss when the computer starts. Pro tip! Make sure the music library is accessible before bliss is started, otherwise bliss will attempt to access the library, fail and then give up. Now, try restarting your computer, and bliss should magically be restarted once your computer has booted. You can leave the
start on startup line out if you like.
There are a further options to configuring Upstart that I haven't mentioned. If you think I've left out something important, let me know in the comments and I'll update the article to produce our canonical bliss startup script!
Hope that helps fix any Linux album art woes!
Thanks to foxypar4 for the image above.