Run "sudo x" in the startup ubuntu

The question is probably silly, but nevertheless. How do you implement correctly run similar command: "sudo vh_runhub" in startup on ubuntu?

You could create the file /etc/init.d/verlihub and write "sudo vh_runhub"
then make
chmod +x /etc/init.d/verlihub
rc-update add default verlihub

But it's not like working way...
October 8th 19 at 03:59
4 answers
October 8th 19 at 04:01
Solution
If vh_runhub need to run from Ruta, in this case, sudo should generally be omitted. The commands in init.d run root.
I somehow had the idea that it is desirable to run it as the user via sudo. Without sudo just won't start. Starting with a user through sudo is the same as to run from root? Can be any sense in running under user instead of root? - Dominique36 commented on October 8th 19 at 04:04
October 8th 19 at 04:03
No sudo. Or human service script or /etc/rc.local.

If root can't run, and the user starts, he lacks any settings (all of a sudden he is somewhere in the ~ store, I don't know, haven't used) or some environment variables.
October 8th 19 at 04:05
Depends on which version of Ubuntu. With 11.10 startup logic changed, and if these actions were enough to add to the startup, now is not enough.

And, as I said, in /etc/init.d/ sudo only need if you want to run the command on behalf of another user (not root), for example,
vasyapupkin sudo su-c "/usr/bin/SUPERFILE"

S. P. May, of course, you did not finish, but
sudo vh_runhub
not enough, you need to add
#!/bin/sh
October 8th 19 at 04:07
add a startup script in /etc/rc.local
or in a crontab file with the option to start at startup

Find more questions by tags UbuntuLinux