Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a two part question.

  1. What is the significance of the @ symbol in systemctl scripts?

  2. How to start vsftpd in fedora 16, (which in some tutorials seems to contain an @ in it's name)? I have done everything the tutorials say, and it still gives me an error. http://blog.tuxforge.com/fedora-16-vsftpd/

What I've done

systemctl enable vsftpd@.service

What I see

Failed to issue method call: No such file or directory

(I have tried this with a absolute path as well, and after I checked there is no such file. The real file does not contain an @ sign, and is located under the /lib/systemd/system/ directory. I have also tried starting and enabling with and without the @ symbol, enabling works, but starting doesn't. I realize the article is now obsolete, but I still cannot seem to start the service. When I try to connect it doesn't let me)

EDIT: I got the service to start somehow, but I would still like to know what the @ symbol means in some service names. Also I am still getting a login error number #500 cannot change directory [...], what does this mean?

To start it I just typed

sudo systemctl enable vsftpd.service

sudo systemctl start vsftpd.service (the problem was I was using an absolute path for this I think)
share|improve this question
up vote 15 down vote accepted

The @ symbol is for special services where multiple instances can be run.

For instance, getty@.service is the service that provides text login terminals. When you press Ctrl+Alt+F2, getty@tty2.service is started, creating virtual terminal #2.

Another service that uses this functionality is OpenVPN. You can create a file /etc/openvpn/work.conf, configured to connect to the VPN at your workplace, and then systemctl start openvpn@work.service to connect to it. Similarly, you could create /etc/openvpn/home.conf, then start openvpn@home.service if you had a VPN at home. This prevents you from having to create a .service file for every VPN you connect to.

But don't take my word for it. Try it out! Let's create a simple service that outputs a message to syslog. Create a file /etc/systemd/system/echo@.service with the following contents:

[Unit]
Description=Echo '%I'

[Service]
Type=oneshot
ExecStart=/bin/echo %i
StandardOutput=syslog

Notice the %i? systemd will populate that with whatever follows the @ sign when the service is started. So, try starting echo@foo.service:

systemctl start echo@foo.service

Then, check the journal:

 journalctl -n10

At the bottom, you'll see that systemd ran /bin/echo foo:

Feb 24 12:41:01 localhost echo[8412]: foo

Now, try systemctl start echo@bar.service. This time, systemd will populate %i with bar, so you'll see:

Feb 24 12:42:51 localhost echo[8432]: bar

That's all there is to it! Anything could potentially follow the @ sign, as systemd just replaces %i in the service definition with it. OpenVPN uses it for configuration, other services might use for something else, like a port number.

share|improve this answer
    
are they started and stopped like normal services except for the inclusion of the @ symbol? For instance if I were to start the service for a second time, would I just do start again? How do u start multiple instances? – rubixibuc Feb 24 '12 at 1:29
    
Yup, just change the text following the @ sign to whatever's appropriate. I added an example you can test out to see how it works. – Patches Feb 24 '12 at 19:50

You must log in to answer this question.

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