I have a systemd file to start a jar file. But I want to execute jar file as *.jar. Is there a way to do this?

Description=Test Background

ExecStart=/usr/bin/java -jar /var/www/test.com/*.jar


I tried this but not working.


From man 5 systemd.service (section "Command Lines"):

This syntax is inspired by shell syntax, but only the meta-characters and expansions
described in the following paragraphs are understood, and the expansion of variables is
different. Specifically, redirection using "<", "<<", ">", and ">>", pipes using "|",
running programs in the background using "&", and other elements of shell syntax are not


Note that shell command lines are not directly supported. If shell command lines are to be
used, they need to be passed explicitly to a shell implementation of some kind. Example:

   ExecStart=/bin/sh -c 'dmesg | tac'

Wildcards are not mentioned as being supported, so you'll have to wrap that command in /bin/sh -c or /bin/bash -c like in the above example.

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.