2

I have a command in bash script that runs my custom application:

./my_app --config ./cfg >> my_app.log 2>>my_app.err

And I want to wrap this into a systemd service. I've done this so far:

[Unit]
Description=my_app
After=syslog.target

[Service]
ExecStart=/home/user123/my_app_dir/my_app --config cfg
Restart=on-abort
WorkingDirectory=/home/user123/my_app_dir
SyslogIdentifier=my_app
User=my_user

[Install]
WantedBy=multi-user.target

How do I have to convert those 2 parts that redirect output into the logs?

1 Answer 1

2
StandardOutput=file:/path/to/log1
StandardError=file:/path/to/log2

See official manual. This will create a new file or overwrite old one, so maybe you want StandardOutput=append:/path/to/log1 in order to keep old logs.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.