Archive for November, 2006

Startup Scripts

Sunday, November 19th, 2006

I’ve been having fun with a webcam under ‘nix, it seemed that even once I got it working properly I had to find a way of starting it at boot time, I thought (foolishly) that it would be a simple matter of adding a line to a boot script, seems not, I had to write/hack a control file for the daemon and only when I had that working could I add it to /etc/rcS.d to start at boot time.

If anyone is interested in the file a copy is available here.

The way I’ve written it you should be able to just change the variables at the top and use it for any (almost) service you want to start at boot or other runlevel, to use it for different runlevels just create a symlink using “ln -s”.

ln -s /etc/init.d/webcam /etc/rcS.d/S99webcam

Because I want it to start at boot time I created a link in the startup runlevel folder, as it’s a start, the file begins with S followed by an order number, as I want it to not bother other services I set it to 99 so it starts last, this is followed by the service name as saved in /etc/init.d

Simple eh? I looked all over for examples of how to do this, and found allsorts, nothing that worked, but I guess that’s just a ‘nix community thing, loads of people writing, and noone checking if what they have said actually works.

I’m fully open to criticism on this, I admit to being a little lacking in knowledge about this stuff, but if I can make it work why do so many so called knowledgable ones manage to get it wrong?

Enjoy!!

Creative Commons License