systemd service to mount google drive directories with gdfuse not working
0
votes
0
answers
865
views
I have a simple service that launches a script that mounts google drive directories via gdfuse . The script works when run manually from the terminal. It fails when launched using systemd, which seems to be the only up-to-date method of setting a script to run on startup from my hours of searching.
Here is the systemd service
gdrive.service
:
[Unit]
Description=Mount google drives
[Service]
ExecStart=/bin/bash /home/james/gdrive.sh
[Install]
WantedBy=multi-user.target
Here is the script:
#!/bin/bash
/usr/bin/google-drive-ocamlfuse -label mydrive /home/james/GoogleDrive/MyDrive/
/usr/bin/google-drive-ocamlfuse -label shareddrive /home/james/GoogleDrive/SharedDrive/
/usr/bin/google-drive-ocamlfuse -label shareddrive2 /home/james/GoogleDrive/SharedDrive2/
And here is the systemctl status when I try to start the service (and yes I have run systemctl daemon-reload):
× gdrive.service - Mount google drives
Loaded: loaded (/etc/systemd/system/gdrive.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-09-14 15:41:19 PDT; 1s ago
Process: 4997 ExecStart=/bin/bash /home/james/gdrive.sh (code=exited, status=2)
Main PID: 4997 (code=exited, status=2)
CPU: 24ms
Sep 14 15:41:19 blister systemd[1] : Started Mount google drives.
Sep 14 15:41:19 blister bash: Fatal error: exception Not_found
Sep 14 15:41:19 blister bash: Fatal error: exception Not_found
Sep 14 15:41:19 blister bash: Fatal error: exception Not_found
Sep 14 15:41:19 blister systemd[1] : gdrive.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Sep 14 15:41:19 blister systemd[1] : gdrive.service: Failed with result 'exit-code'.
I have also replaced gdrive.sh with a simple echo hello
script and it launches successfully, so my systemd setup is functioning in principle... based on the errors, it seems like when run from systemd, the google-drive-ocamlfuse command is not being found (even though I replaced everything with absolute paths just in case). If it helps, I am on Xubuntu.
Asked by user3750332
(1 rep)
Sep 14, 2022, 11:00 PM