How to add service on system reboot

Jason Dixon jason at dixongroup.net
Thu May 27 11:51:07 UTC 2004


On May 26, 2004, at 6:43 PM, Muhammad Rizwan Khan wrote:

> I have written a serive in C++,,, it runs as daemon. I always start 
> this
> service manually typing this command:
>  /usr/bin/myservice start
> I want to run this service atomatically when system reboots.

Easiest method:
echo '/usr/bin/myservice start' >> /etc/rc.local

More involved but more elegant solution:
Create an init script like those found in /etc/rc.d/init.d/.  In 
particular, you'll need the "# chkconfig" and "# description" entries 
(see /etc/rc.d/init.d/sshd for an example).  Then use "chkconfig --add 
<service name>" to add the init script and "chkconfig <service name> 
on" to activate the default runlevels.

HTH.

--
Jason Dixon, RHCE
DixonGroup Consulting
http://www.dixongroup.net






More information about the redhat-list mailing list