4

I've created a service; lets call it abc.service. I run:

sudo systemctl enable /home/pi/abc.service 1>output.txt 2>error.txt

and output.txt is empty while error.txt contains:

Created symlink /etc/systemd/system/multi-user.target.wants/abc.service -> /home/pi/abc.service.
Created symlink /etc/systemd/system/abc.service -> /home/pi/abc.service.

Why is this?

EDIT: My purpose is this -- I have a global program running that can run commands, and commands with stderr are flagged and printed to error files. However, it seems like systemd is printing to stderr (and therefore my error files) even though it seems like it's not an error.

EDIT2: Example systemd file:

[Unit]
Description=Test file

[Service]
Type=simple
ExecStart=/bin/ls /home/pi

[Install]
WantedBy=multi-user.target

Just tested, enabling this file prints to stderr (like error.txt from above). Tested service, prints dir contents of home directory.

6
  • adding your abc.service content might help too. – dedunumax Oct 21 '19 at 13:05
  • @dedunumax done. – Some Guy Oct 21 '19 at 14:07
  • Not an expert but are you running ls at a time there is no standard output to display on? If so output to Standard Error sounds benefitial. – WinEunuuchs2Unix Oct 22 '19 at 12:36
  • I've run/restarted this script during appropriate times where displays were available and the system was fully booted to a desktop @WinEunuuchs2Unix – Some Guy Oct 22 '19 at 17:17
  • did you find the solution for your problem? I also have this and would like to not have this as en error.... – oberfreak Oct 27 '19 at 20:51
0

There is a lot of documentation here: systemd man page

You might also redirect the "enable" output to stdout (although that might redirect real errors there too.

It does seem like the action does not follow Unix "standards" as to what is an error and what is not.

1
  • I've looked into bypassing my own error/warning filters for certain text, like the one outputted by enable, but it seems like the wrong solution and may be tedious to deal with in the future if and when that text ever changes (likely? probably not...) – Some Guy Oct 22 '19 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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