"unrecognised service" for my new systemd script

15,768

The service command puts the object first:

service foo start

The systemctl command does the opposite:

systemctl start foo
Share:
15,768

Related videos on Youtube

spraff
Author by

spraff

Updated on September 18, 2022

Comments

  • spraff
    spraff over 1 year

    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

  • spraff
    spraff over 7 years
    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.