1
I'm trying to run a find
command on a directory which contains unit files:
find /home/pi/units -type f -name "*.service"
which returns
/home/pi/units/manager.service
I then want to pipe that output into a find
command to enable everything in that directory. I have tried a couple of different ways, but none work:
$ sudo systemctl start $(find /home/pi/units -type f -name "*.service")
Failed to start home-pi-units-manager.service.mount: Unit home-pi-units-manager.service.mount not found.
$ find /home/pi/units -type f -name "*.service" | xargs sudo systemctl start
Failed to start home-pi-units-manager.service.mount: Unit home-pi-units-manager.service.mount not found.
$ find /home/pi/units -type f -exec sudo systemctl start {} \;
Failed to start home-pi-units-manager.service.mount: Unit home-pi-units-manager.service.mount not found.
I want it to run:
sudo systemctl enable /home/pi/units/manager.service
sudo systemctl start /home/pi/units/manager.service
Why is it trying to run this home-pi-units-manager.service.mount
when find
outputs /home/pi/units/manager.service
Your
find
commands are not the problem; they are finding the .service files you want, but the actual starting/enabling of these services is not working. You should rephrase the question to inquire as to whymanager.service
is referencing a service it can't find. – ajgringo619 – 2019-09-14T23:05:14.497