2

I have done a linux service using the article on this link http://shahmirj.com/blog/the-initd-script

After that I copied the files into the init.d directory

cp -f "myserviced" "/usr/sbin/myserviced"
cp -f "myservice" "/etc/init.d/myservice"
ln -s "/etc/init.d/myservice" "/etc/rc2.d/S99myservice"
ln -s "/etc/init.d/myservice" "/etc/rc0.d/K99myservice"

In the next step I started the service using the command Collapse | Copy Code

service myservice start

Then it prints like this myservice: unrecognized service

Why I am getting this error. I am using Ubuntu OS for installing my service. Not installed any chkconfig tool for installing services on linux. How I can solve this without installing any other tools.

7
  • I created my myserviced using C++ Dec 27, 2012 at 12:29
  • Do you use sudo?
    – Karthik T
    Dec 27, 2012 at 12:36
  • Also i believe the Init system is phased out in favour of upstart(or in the process of being phased out), not sure of details
    – Karthik T
    Dec 27, 2012 at 12:37
  • yes I am using sudo Dec 27, 2012 at 12:37
  • I cant find the option, but you would be better served taking up this question in Ubuntu or the unix stack exchanges, its rather off topic here.
    – Karthik T
    Dec 27, 2012 at 12:39

1 Answer 1

1

I solved the issue by using a skeleton script on Ubuntu OS

Debian and therefore Ubuntu, supplies a template that uses the Debian start-stop-daemon command to start and stop daemons. It is only necessary to copy this template to a new file of the correct name and modify it for the purpose.

sudo cp /etc/init.d/skeleton /etc/init.d/mydaemon

My Ubuntu service is working perfect now. Check this article for more details for any others who struggle to create a daemon on Ubuntu OS

http://www.andrewault.net/2010/05/27/creating-a-perl-daemon-in-ubuntu/

You must log in to answer this question.

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