![Systemd:このデバイスに何の問題がありますか? [コピー]](https://linux33.com/image/7164/Systemd%EF%BC%9A%E3%81%93%E3%81%AE%E3%83%87%E3%83%90%E3%82%A4%E3%82%B9%E3%81%AB%E4%BD%95%E3%81%AE%E5%95%8F%E9%A1%8C%E3%81%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%99%E3%81%8B%EF%BC%9F%20%5B%E3%82%B3%E3%83%94%E3%83%BC%5D.png)
私はこのユニット()を書いた:/etc/systemd/system/[email protected]
[Unit]
Description=TEST (%I)
[Service]
ExecStart=/bin/echo "%i %I" >> /home/vagrant/test.txt
[Install]
WantedBy=multi-user.target
実行systemctl enable test@
後、systemctl start 'test@slug=test phone=999999999999'
ファイルはまったく表示されません/home/vagrant
。
出力はsystemctl status 'test@slug=test phone=999999999999'
次のとおりです
● test@slug\x3dtest\x20phone\x3d99999999999.service - TEST (slug=test phone=99999999999)
Loaded: loaded (/etc/systemd/system/[email protected]; 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
を使用して構文エラーを確認しようとしましたが、出力はです。systemd-analyze verify [email protected]
Failed to load [email protected]: Invalid argument
答え1
できません>>
。ExecStart
リダイレクトを実行できるシェルを実行または設定する必要がありますStandardOutput=
。
ExecStart=/bin/bash -c 'echo "%i %I" >> /home/vagrant/test.txt'