You are not logged in.
I would like to copy files from /boot/ to /boot/efi/ using a systemd service. Here is my unit file in its current form:
[Unit]
Description=Copy boot files
RequiresMountsFor=/boot/efi /boot /home
[Service]
Type=oneshot
ExecStart=/usr/bin/rsync -tAHX /boot/* /boot/efi/.
[Install]
WantedBy=multi-user.targetI tried using /usr/bin/cp before going the rsync route, but both are failing with the same error:
cannot stat '/boot/*': no such file or directoryThe RequiresMountsFor was added after previous failed attempts (the service is originally intended to run before shutdown, this new unit is one I'm using for debugging the error).
The same rsync command works when executed from terminal.
Is there a reason my service wouldn't be able to access/read the files on /boot?
Last edited by TheCoon (2018-04-17 11:53:20)
Offline
ExecStart is limited, it doesn't start a shell, so it can't do globbing (and is also why you need absolute binary paths). If you need globbing, then make a script with an appropriate shebang, or wrap the command in a shell (e.g. 'ExecStart=/usr/bin/bash -c "blah blah blah"'.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
I learned something new today. Thank you!
Offline