1

Am running Ubuntu8.10 Desktop.. as a server. When I logoff the machine all the services eg apache, ssh etc.... stop.

Is there a way to make these services run all the time?

Regards

2
  • How did you install those applications? Jun 27, 2009 at 4:47
  • Everyone.. thanks so much for comments... been away for a few days on a roadtrip.. will be back in office tomorrow to tame this linux beast with all your ideas... many thanks. Jun 29, 2009 at 4:19

10 Answers 10

3

I think what is happening is, that NetworkManager connects his net connection only when he logs in.

You should try:

Right Click Networkmanager icon -> Edit Connections -> Select connection from Wired or Wireless tab as appropriate and Click Edit.

Make sure "Connect Automatically" is selected.

1
  • Thanks Bash.. what was happening was that my network connection (in the Ubuntu VM) was setup to be manual. However it didn't have a MAC address, and the default network connection was coming back. So I deleted it, and set my manual connection with a MAC address.. and ticked 'System Setting'. Cheers. Jun 29, 2009 at 21:54
6

Normally, those services would run in the background, starting before the first login, and continuing after the user logs out. Ubuntu Desktop is really Ubuntu Server plus X and Gnome :)

How are you starting the services?

The best thing to do is to make sure you're starting the services via init scripts. See for example:

http://www.debuntu.org/how-to-manage-services-with-update-rc.d

3

Which runlevel is your machine running at?

In /etc/inittab, look for the line

id:x:initdefault:

where x is your default runlevel.

It could be that you're running at runlevel 1. At that runlevel, your daemons are not configured to run automatically.

Set your default runlevel to one of the multi-user runlevels (2-5 on my Debian machine). On my machine, runlevel 2 causes the daemons (apache, sshd and others) to be started automatically by the system.

2

You don't want to start that type of stuff as a user, so I recommend that you follow the other advice in this question.

But if you want to do a little test, before you do a permanent solution you could use the disown command.

To quickly get what disown does you could try this:

  1. start a new terminal window
  2. start xclock (or something like that)
  3. close the terminal window, and notice that xclock closes with the terminal.

And then do the same

  1. start a new terminal window
  2. xclock &
  3. disown
  4. close the terminal window, and notice that xclock is still alive.

/Johan

1

Unless you are starting the daemons as a user and the daemons attach them self to the users standard out/in, they should be running in the background not being bothered who is logged in or not. So what did you actually do that doesn't make the daemons run in background?

0

Check out the "screen" command. Screen will continue running after you log off.

Here's an example:

  1. "screen -S [session name]" - A session name is useful if you use screen more than once.

  2. Execute whatever command/program you want to keep running.

  3. Press CTRL-A then CTRL-D (to detach)

  4. Log out (or whatever) and you can come back later and execute "screen -ls". You should see your previous session(s) listed.

  5. "screen -r [session name]" will resume that session.

Hope this helps.

1
  • This doesn't apply to services and daemons. Jun 26, 2009 at 8:31
0

Another way to do it might be to create a new user:

Adminisration --> Users and Groups --> Add User

Create your new user then run whatever program(s) you wish as that user instead of yourself. Some folks also like to give that use less privileges which potentially increases your security.

Also look into runlevels.

1
  • This doesn't apply to services and daemons. Jun 26, 2009 at 8:31
0

That should be taken care of by runlevels. Do you have a simlink /etc/rc5.d/sapache that links to /etc/init.d/apache2?

0

You may not have a /etc/inittab file, since Ubuntu uses Upstart and doesn't create one by default.

You can check your runlevel using the runlevel command. The last character it prints should be "2" or higher. You can create the /etc/inittab file if it doesn't exist. The line controlling the default runlevel should be as indicated in Convicts answer.

If you installed your services using a Ubuntu package manager (apt-get, Synaptic, etc.) the proper startup scripts should have been installed. See the answer by mibus for additional information.

0

I believe Bash was correct.

However if you want to make your computer sign into the network before you even log in (at startup), also check "System Setting" (Intrepid) or "Available to all users" (Jaunty). This will allow ANY user to connect to the connection, including the system when it starts up.

You must log in to answer this question.

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