You are not logged in.

#1 2015-03-25 10:11:05

nopemopes
Member
Registered: 2015-03-23
Posts: 12

[Solved] service script file or directory not found but can open.

Hey all,

After struggling with creating a systemd user service + timer, i finally got it work. When i needed to install my arch again, and did the same steps as i did last time, my service file says it can't find the script at the ExecStart.
The weird thing is, i can open the script with nano and can see it in the file manager so i don't know where to look now.

These are my services files and timer located in /home/username/.config/systemd/user/

[Unit]
Description=Sync grive every 5 minutes

[Timer]
OnBootSec=2min
OnUnitActiveSec=5min
Unit=drive_sync.service

[Install]
WantedBy=default.target
[Unit]
Description=Sync grive

[Service]
ExecStart=/etc/drive_script.sh

And this is the script called in /etc/

#!bin/bash

cd /home/jordy/Google\ Drive/
grive

I enabled the time with systemctl --user enable drive_sync.timer and it's running but after 5 minutes i check the status of drive_sync.service with systemctl --user status drive_sync.service and it says: "Failed at step ExecStart=/etc/drive_script.sh: No such file or directory" But this file really does exist.

I also ran sudo chmod u+x /etc/drive_script.sh but this didn't work.

Last edited by nopemopes (2015-03-26 06:37:44)

Offline

#2 2015-03-25 10:50:59

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] service script file or directory not found but can open.

What was the file name before? Are you sure it was /etc/drive_script.sh too?
What's the output of

ls -l /etc/drive_script.sh

You have drive_sync.service but drive_script.sh - a typo?

I don't think putting it in /etc is a good idea in the first place.

Offline

#3 2015-03-25 10:52:05

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved] service script file or directory not found but can open.

nopemopes wrote:

i check the status of drive_sync.service with systemctl --user status drive_sync.service and it says: "Failed at step ExecStart=/etc/drive_script.sh: No such file or directory"

That message looks a little strange, but you also removed all context. In your previous thread (which you should probably mark as solved now?) you were pointed to a sticky about posting complete commands/output/error messages, but you are (still) not doing that. Just put the command and its output in code tags in your post. Don't do any rephrasing, translating, interpreting or other editing to obscure details (unless it's a password or something like that).

I also ran sudo chmod u+x /etc/drive_script.sh but this didn't work.

Does your user ("username" or "jordy") own that file? Otherwise that is not enough (but the error would mention something about permission issues). And /etc/ doesn't seem like a really appropriate place for a script and if it's only for a specific user, you might put in somewhere under ~ (but that is something you can consider after you get it working with the current location).

Last edited by Raynman (2015-03-25 10:53:09)

Offline

#4 2015-03-25 10:53:50

nopemopes
Member
Registered: 2015-03-23
Posts: 12

Re: [Solved] service script file or directory not found but can open.

karol wrote:

What was the file name before? Are you sure it was /etc/drive_script.sh too?
What's the output of

ls -l /etc/drive_script.sh

You have drive_sync.service but drive_script.sh - a typo?

I don't think putting it in /etc is a good idea in the first place.

Yes i am sure it was the same because i copied it from my google drive folder to /etc. I named my script like that because i tought it's easier to see what purpose it has.

The reason i chose /etc is simply because i don't exactly know where to put my user script files. I put my acpi_call script at /etc because i have a system wide service that shuts my discrete vga off. It calls /etc/vga_off.sh.

Offline

#5 2015-03-25 11:01:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,571
Website

Re: [Solved] service script file or directory not found but can open.

And what about that ls -l output?  It sounds like you never (properly) made it executable.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2015-03-25 11:02:47

nopemopes
Member
Registered: 2015-03-23
Posts: 12

Re: [Solved] service script file or directory not found but can open.

Raynman wrote:
nopemopes wrote:

i check the status of drive_sync.service with systemctl --user status drive_sync.service and it says: "Failed at step ExecStart=/etc/drive_script.sh: No such file or directory"

That message looks a little strange, but you also removed all context. In your previous thread (which you should probably mark as solved now?) you were pointed to a sticky about posting complete commands/output/error messages, but you are (still) not doing that. Just put the command and its output in code tags in your post. Don't do any rephrasing, translating, interpreting or other editing to obscure details (unless it's a password or something like that).

I also ran sudo chmod u+x /etc/drive_script.sh but this didn't work.

Does your user ("username" or "jordy") own that file? Otherwise that is not enough (but the error would mention something about permission issues). And /etc/ doesn't seem like a really appropriate place for a script and if it's only for a specific user, you might put in somewhere under ~ (but that is something you can consider after you get it working with the current location).

sorry, I don't know how to mark the post. Still looking how the forums work so sorry for any misunderstandings,

I tried again with a clean start. Removed the previous services and such and created them directly, So i am sure i own the file. I created the script in my home directory and then copied it to /etc with sudo cp.

Sorry about not posting the error in codes. I didn't know i had to put the error also in code tags, only the scripts.

this happens after the timer has reached it's execution time and executes the drive_sync.service:

failed at step exec spawning /etc/drive_script.sh: no such file or directory

Last edited by nopemopes (2015-03-25 11:25:38)

Offline

#7 2015-03-25 11:03:55

nopemopes
Member
Registered: 2015-03-23
Posts: 12

Re: [Solved] service script file or directory not found but can open.

Trilby wrote:

And what about that ls -l output?  It sounds like you never (properly) made it executable.

I can't try it right now because my personal laptop isn't right here right now.

I can tell you that i copied it to /etc and then made it executable with sudo chmod u+x /etc/drive_script.sh. I also tried it with chmod 775

I create the service files in (my home directory)/.config/systemd/user
Where should i create the script then?

Is the location of my vga_off.script also wrong then? because i put that one in /etc because it has to be executed at every boot by the vga_off.service located in /etc/systemd/system/.


Is my way of putting scripts on these locations wrong?

Last edited by nopemopes (2015-03-25 11:13:03)

Offline

#8 2015-03-25 11:20:13

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [Solved] service script file or directory not found but can open.

nopemopes wrote:

sorry, I don't know how to mark the post.

If you're new, please read the FAQ in the wiki and the sticked topics in various sections of them forum, especially the Newbie Corner e.g. https://bbs.archlinux.org/viewtopic.php?id=130309

It's preferable to reply to various people in one post then to bump the thread many times.

Offline

#9 2015-03-25 11:23:56

nopemopes
Member
Registered: 2015-03-23
Posts: 12

Re: [Solved] service script file or directory not found but can open.

karol wrote:
nopemopes wrote:

sorry, I don't know how to mark the post.

If you're new, please read the FAQ in the wiki and the sticked topics in various sections of them forum, especially the Newbie Corner e.g. https://bbs.archlinux.org/viewtopic.php?id=130309

It's preferable to reply to various people in one post then to bump the thread many times.

I marked it as solved! sorry for any disturbance and such. I am doing my best to understand how things work in arch.

Offline

#10 2015-03-26 06:37:07

nopemopes
Member
Registered: 2015-03-23
Posts: 12

Re: [Solved] service script file or directory not found but can open.

I finally got it working!

I don't know what was wrong, but i installed arch again. Then when everthing was configured, i copied the drive_sync script to ~/scripts and edited my service files.

I enabled them et voila! It works smile

Thanks for pointing me in the right direction!

Offline

Board footer

Powered by FluxBB