2

I created a new systemd script /etc/systemd/system/foo.service

[Unit]
Description="My foo script"
Before=network-pre.target
Wants=network-pre.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/foo

When I run service start foo or service start foo.service

start: unrecognized service

What's wrong? Ubuntu 16.04

1 Answer 1

5

The service command puts the object first:

service foo start

The systemctl command does the opposite:

systemctl start foo
1
  • Thanks. Mind telling me what I need to do to make it start before networking comes up at boot? (It works correctly as service foo start) I thought the Before=network-pre.target would be enough but apparently not.
    – spraff
    Dec 14, 2016 at 20:33

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.