You are not logged in.
Pages: 1
Hey,
I'm new to systemd and I'm trying to set up a really easy service file. It's supposed to generate a list of explicitly installed packages.
The file is as follows (/etc/systemd/system/pkglist.service):
[Unit]
Description=Backup a list of installed software
[Service]
Type=oneshot
ExecStart=/usr/bin/pacman -Qet > /home/cons/Dropbox/Dokumente/Dokumente/Arch/pkglist.txt
Running it with systemctl start pkglist.service returns an error and systemctl status pkglist.service returns:
● pkglist.service - Backup a list of installed software
Loaded: loaded (/etc/systemd/system/pkglist.service; static; vendor preset: disabled)
Active: failed (Result: exit-code) since Mi 2015-07-08 10:07:22 CEST; 6s ago
Process: 6284 ExecStart=/usr/bin/pacman -Qet > /home/cons/Dropbox/Dokumente/Dokumente/Arch/pkglist.txt (code=exited, status=1/FAILURE)
Main PID: 6284 (code=exited, status=1/FAILURE)
Jul 08 10:07:22 cons-arch systemd[1]: Starting Backup a list of installed software...
Jul 08 10:07:22 cons-arch pacman[6284]: Fehler: Paket '>' wurde nicht gefunden
Jul 08 10:07:22 cons-arch pacman[6284]: Fehler: Paket '/home/cons/Dropbox/Dokumente/Dokumente/Arch/pkglist.txt' wurde nicht gefunden
Jul 08 10:07:22 cons-arch pacman[6284]: Warnung: '/home/cons/Dropbox/Dokumente/Dokumente/Arch/pkglist.txt' ist eine Datei, Sie möchten vielleicht -p/--file benutzen.
Jul 08 10:07:22 cons-arch systemd[1]: pkglist.service: Main process exited, code=exited, status=1/FAILURE
Jul 08 10:07:22 cons-arch systemd[1]: Failed to start Backup a list of installed software.
Jul 08 10:07:22 cons-arch systemd[1]: pkglist.service: Unit entered failed state.
Jul 08 10:07:22 cons-arch systemd[1]: pkglist.service: Failed with result 'exit-code'.
So, as far as I can tell, pacman wants to treat ">" and the file path as packages.
However, running /usr/bin/pacman -Qet > /home/cons/Dropbox/Dokumente/Dokumente/Arch/pkglist.txt as root returns the desired outcome and I end up with a file of installed packages.
Why is there a difference between running it in a terminal and executing it with systemd?
I'm sorry if the answer is right in front of me and I'm just too dumb to see it
Last edited by Heavy Rain (2015-07-08 09:41:09)
Offline
See the man page (systemd.service) section on Command Lines...
Offline
Thank you for the reply!
Quotes don't seem to work though, it returns the same error.
However, I found this passage in the man page:
This syntax is intended to be very similar to shell syntax, but only the meta-characters and expansions described in the following paragraphs are understood.
Specifically, redirection using "<", "<<", ">", and ">>", pipes using "|", running programs in the background using "&", and other elements of shell syntax are not supported.
It seems redirections are just not supported?
Offline
That's it. You could always work around it by putting the redirection in a script and calling that...
Offline
Thank you, I'll look into that!
Offline
Pages: 1