0

I have a service configured with systemctl. This is the config file:

[Unit]
Description=eureka-server
After=syslog.target

[Service]
User=bhushanp
#User=root
ExecStart=/usr/bin/java -jar /home/bhushanp/apps/eureka_server.jar > /var/log/es.log 2>>&1
SuccessExitStatus=143

[Install]
WantedBy=multi-user.target

But its not writing logs to /var/log/es.log file.
Any help is appreciated.

Bhushan
  • 93
  • 1
  • 11

1 Answers1

2

ExecStart is not managed by a shell, so if you want that, prefix it with /bin/sh -c and quote your arguments. I would recommend you rather let stdout be connected to the journal and look at log output using journalctl -u foo.service than grabbing it out of a file on disk.

If you want to follow the log in a similar fashion to tail -f, you can use journalctl -f -u foo.service.

Tollef Fog Heen
  • 692
  • 3
  • 10