Perforce - How do you create a new service?

I’d like my SUSE 11.1 server to host “Perforce”, but I’d rather not manually start Perforce every time I reboot the machine.

So I have a very simple basic Linux question:

How do I create a new service?

It’s easy enough to enable a service that comes pre-installed, but adding a new server service seems to not be documented anywhere.

  1. You copy the file /etc/init.d/skeleton to /etc/init.d/<your-service-name>.
    Where <your-service-name> is better not a name already existing in /etc/init.d/ (in your case *perforce *would do I think).

  2. Edit the file. Start by reading the comment carefully. It documents what to do with it. Some of the lines starting with a # (comments for the shell) are nevertheless important because they tell at what runlevel the service must be started/stopped.

  3. When the file is correct, you can go to YaST > System > System services (runlevel) and you will find perforce there. Start from there and, as YaST says, after Finish it will be registered for starting at next boot (that is, the links needed for this are made by YaST).

Thank you!

It took a bit of banging (to figure out how to get it to launch so that it knew the correct directory for the Perforce server files) but I’ve got it running. {smile}

I find it very confusing that it actually USES lines that are commented out! Is there some official documentation (aside from the comments in the skeleton file) of this?

Search the Web for documentation on “Linux Standard Base”.

Nice you got it sorted out. If you grub/meunderstand this you are on your way to Linux guruship :wink:

The trick with lines that are comment to one software, but nevertheless are doing things to other software is a bit confusing. Nevertheless an other example is (should be) in every script. It starts with e.g.


This is interpreted by the program loader, which will load/execute /bin/bash. Then bash will intrprete the script and it will skip that first line because it is a comment line.

Another you will find in /boot/grub/menu.lst. The lines starting with ### there are comments for GRUB, but they are interpreted by YaST. That is why it says “Don’t change …”.

I did the same thing several times on several projects on different languages (even on non Unix/Linux sysems).

In this case I think that the best doc is in the skeleton file. But I agree that it is a bit hidden. Maybe Akoellhs’ post helps here.

I did a search on “Linux Standard Base” documentation but ended up at a website that didn’t have any documentation, just an effort to standardize software distribution to support any flavor of Linux.

I did a bit more searching and found what looks like a good documentation site:
The Linux Documentation Project: Guides

And there is a guide on BASH that should answer most of my issues for stuff like this.

I do have one question which perhaps someone could easily point me in the right direction. With xinet.d I can configure a service to run as a particular user. How can I run the “perforce” service, via the /etc/init.d/skeleton method hcw mentioned, as a particular user? (for security purposes it’s best to not run everything as root)

Even though I’ve run Linux servers for over a decade, they require almost no attention after initial setup, so I doubt I’ll ever become a Linux “guru”.

Apache does something like that. It starts as root (of course,) but that process splits off (in this case more, but that is irrilevant) new processes that run as *wwwrun *and do the real work. But that is build in in Apache, so I think it will not be easy to implement in another product when it is not part of the design.

I did a search on “Linux Standard Base” documentation but ended up at a website that didn’t have any documentation,