D
D
desecho2011-12-25 13:04:50
linux
desecho, 2011-12-25 13:04:50

Running "sudo x" in ubuntu autostart

Probably a stupid question, but still. How can I correctly implement the launch of a similar command: "sudo vh_runhub" in autorun on ubuntu?

It would be possible to create a file /etc/init.d/verlihub and write "sudo vh_runhub" in it,
then do
chmod +x /etc/init.d/verlihub
rc-update add verlihub default

But this does not seem to be a working way ...

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Riateche, 2011-12-25
@desecho

If vh_runhub needs to be run as root, then in this case sudo should be omitted altogether. Commands in init.d are executed as root.

Z
z0rc, 2011-12-25
@z0rc

No sudo. Or a human service script or /etc/rc.local.
If it can’t be launched from the root, but it starts from the user, then it lacks either some settings (suddenly it stores them somewhere in ~, I don’t know, I didn’t use them), or some environment variables.

B
bugaga0112358, 2011-12-26
@bugaga0112358

Depending on what version of Ubuntu. Since 11.10, the autorun logic has been changed, and if before the actions you listed were enough to add to autorun, now it is not enough.
And, as already said, in /etc/init.d/ you only need sudo if you want to run the command on behalf of another user (not root), for example,
sudo su vasyapupkin -c "/usr/bin/SUPERFILE"
PS Maybe, of course, you didn’t add it, but it’s
sudo vh_runhub
not enough, you need add
#!/bin/sh

N
Nikolai Turnaviotov, 2011-12-29
@foxmuldercp

append script launch to /etc/rc.local
or crontab with option to start at startup

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question