This question already has an answer here:

I wrote this unit (/etc/systemd/system/test@.service):

Description=TEST (%I)

ExecStart=/bin/echo "%i %I" >> /home/vagrant/test.txt


After I run systemctl enable test@ and systemctl start 'test@slug=test phone=999999999999', I don't see any file on /home/vagrant.

The output of systemctl status 'test@slug=test phone=999999999999' is:

● test@slug\x3dtest\x20phone\x3d99999999999.service - TEST (slug=test phone=99999999999)
   Loaded: loaded (/etc/systemd/system/test@.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

May 01 15:40:51 vagrant-ubuntu-wily-32 systemd[1]: Started TEST (slug=test phone=99999999999).
May 01 15:40:51 vagrant-ubuntu-wily-32 echo[2161]: slug\x3dtest\x20phone\x3d99999999999 slug=test phone=99999999999 >> /home/vagrant/test.txt

I tried to use systemd-analyze verify test@.service to check for syntax errors but the output is: Failed to load test@.service: Invalid argument.

marked as duplicate by don_crissti, Jakuje, Anthon, garethTheRed, MelBurslan May 1 '16 at 21:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


You cannot use shell style >> redirection in ExecStart. You need to get it to run a shell that can do the redirection for you, or set StandardOutput=. For example, try

ExecStart=/bin/bash -c 'echo "%i %I" >> /home/vagrant/test.txt'

Not the answer you're looking for? Browse other questions tagged or ask your own question.