K
K
Komonec2011-04-21 23:52:06
ubuntu
Komonec, 2011-04-21 23:52:06

How to add daemon to autoload in ubuntu server?

There is an ubuntu server, tell me how to add a daemon to startup. The daemon is /folder/daemon.
As I understand it, you need to create a script, make it executable and add it to startup? And maybe there is an easier way?
By the way, I found about autorun, but what should the script look like?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
S
sajgak, 2011-04-22
@Komonec

If there is a fear in writing all kinds of scripts, then the simplest solution is to hang a cron job on the @reboot event. Of course, I don’t want to teach bad things, but for some tasks this is also a way out)

C
Cepega, 2011-04-22
@Cepega

update-rc.d

G
galaxy, 2011-04-22
@galaxy

ubuntu way is /etc/init/daemon.conf
help.ubuntu.com/community/UbuntuBootupHowto

A
antivir, 2011-04-22
@antivir

I am using the sysv-rc-conf package.
Similar to chckconfig:
sysv-rc-conf service on
sysv-rc-conf service off

K
Komonec, 2011-04-22
@Komonec

And so, I'll do it all over again:
1. Remove the script from autostart, #sudo update-rc.d autostart.script remove: 2. Edit, #sudo nano /etc/init.d/autostart.script (changed the position, so be it for now will be, then I will add the user): 3. I allow the file to be executed, #sudo chmod +x /etc/init.d/autostart.script 4. I add the file to autostart, #sudo update-rc.d autostart.script defaults 95: 5. I reboot and look at htop, there is no dropbox :( What is the warning: /etc/init.d/autostart.script missing LSB information ?
Removing any system startup links for /etc/init.d/autostart.script ...
/etc/rc0.d/K94autostart.script
/etc/rc1.d/K94autostart.script
/etc/rc2.d/S94autostart.script
/etc/rc3.d/S94autostart.script
/etc/rc4.d/S94autostart.script
/etc/rc5.d/S94autostart.script
/etc/rc6.d/K94autostart.script

#!/bin/bash
/home/komonec/.dropbox-dist/dropboxd

update-rc.d: warning: /etc/init.d/autostart.script missing LSB information
update-rc.d: see <wiki.debian.org/LSBInitScripts>
Adding system startup for /etc/init.d/autostart.script ...
/etc/rc0.d/K95autostart.script -> ../init.d/autostart.script
/etc/rc1.d/K95autostart.script -> ../init.d/autostart.script
/etc/rc6.d/K95autostart.script -> ../init.d/autostart.script
/etc/rc2.d/S95autostart.script -> ../init.d/autostart.script
/etc/rc3.d/S95autostart.script -> ../init.d/autostart.script
/etc/rc4.d/S95autostart.script -> ../init.d/autostart.script
/etc/rc5.d/S95autostart.script -> ../init.d/autostart.script

K
Komonec, 2011-04-22
@Komonec

And so almost everything turned out, but one BUT.
Autoload works if I run the daemon as root, if as a normal user, then autoload does not work :( But even if I run it as root, then after #sudo reboot, this is bullshit (sorry for the quality):
#!/bin/bash
su - username /home/username/Dropbox/.dropbox-dist/dropboxd

K
Komonec, 2011-04-22
@Komonec

Right now everything works, but, after #sudo reboot: I use putty, I type #sudo reboot, the output is: But, the computer does not reboot, and putty does not throw an error. After I again write in putty #sudo reboot, and finally the reboot occurs. Oo

Широковещательное сообщение от [email protected]
(/dev/pts/0) в 15:13...
The system is going down for reboot NOW!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question