1

Here it's what I do:

1) create an user some_deployer
2) then create a folder to script like /company/script/<service name>
3) in this folder I create the start.sh and stop.sh scripts and give the ownership to the user some_deployer and the permission with chmod 755.
4) then after create the script in /etc/init.d/ folder, like <service name>-service and give the ownership to the user some_deployer and the permission with chmod 755 too.
5) then add this service to the list of services, still inside of the /etc/init.d/ with

/sbin/chkconfig --add -service (suse) or update-rc.d <service name> defaults (ubuntu)

Is this correct ? Is this the best way to proceed it ? I'm asking 'cause suddenly one of my service that I'm creating is not working anymore, I'm trying the command /etc/init.d/-service and it says that the command is not found, why is that ?

2 Answers 2

2

It isn't necessary to create a user, but you certainly can if its to your advantage. not sure what your talking about with /company/script/, but no reason not to. just make sure that your script file is in /etc/init.d before running update-rc.d. I'm not sure why you want to use /company/script/ but from your error, your service name is not coming through.

Look into the LSB specs for an init.d script here:http://wiki.debian.org/LSBInitScripts you create a single script with the capabilities stop/start/restart/force-reload/status, and then register it with update-rc.d or whatever as you have suggested. that will allow update-rc.d to point to a single file, but perform all the required operations using it.

2

Don't believe LSB too much, most distributions have long abandoned sysvinit, Ubuntu, RHEL use upstart (in RHEL's case mostly in SysV compatibility mode), Fedora is using systemd for more than a year now, in Fedora 18 almost all services are native systemd. One of systemd's promises is to continue handling LSB-compatible setups, but it offers many advantages if using the native configuration. Take a look at its extensive documentation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .