LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Systemd service trims script directory (https://www.linuxquestions.org/questions/linux-newbie-8/systemd-service-trims-script-directory-4175641350/)

tankzeu 10-29-2018 04:52 AM

Systemd service trims script directory
 
I have in my test123.service file the following line for ExecStart :
"ExecStart=/home/test/Documents/s (there are 5 spaces here) s/s (there are 10 spaces here) ssss/bin/test123.sh start systemd",which is correct .However when I start the service I get the following error :

" Process: 2864 ExecStart=/home/test/Documents/s s/s ssss/bin/test123.sh start systemd (code=exited, status=203/EXEC)" .It seems that the folders are trimmed and that is why it fails.Any suggestions how can I fix this?

bradvan 10-29-2018 06:49 AM

It is because you have spaces in the directory structure and have not escaped them. I would remove the spaces. Also would not recommend putting a system start script under /home.

scasey 10-29-2018 09:06 AM

If you put your code in [code] tags when posting here, the spaces will be preserved.
As stated, you'll need to escape the spaces, although why you've created directory names with spaces in them is a mystery.

ondoho 10-31-2018 03:01 AM

Quote:

Originally Posted by tankzeu (Post 5920404)
I have in my test123.service file the following line for ExecStart :
"ExecStart=/home/test/Documents/s (there are 5 spaces here) s/s (there are 10 spaces here) ssss/bin/test123.sh start systemd",which is correct .However when I start the service I get the following error :

" Process: 2864 ExecStart=/home/test/Documents/s s/s ssss/bin/test123.sh start systemd (code=exited, status=203/EXEC)" .It seems that the folders are trimmed and that is why it fails.Any suggestions how can I fix this?

so basically you are testing "how can i make systemd fail".
it seems you succeeded.
as far as my experience with systemd, it really likes to adhere to the time-honored tradition of not putting spaces in filenames.

i don't know why you don't use code tags (they preserve formatting) but it looks like all subsequent spaces got concatenated into 1.
you could try escaping each space like this:
Code:

ExecStart=/home/test/Documents/s\ \ \ \ \ sss/..etc.......
and i'm pretty sure the first " (doublequote) belongs AFTER ExecStart=, not before it.


All times are GMT -5. The time now is 11:47 AM.