How to run script properly at startup to automount google drive (gcsf)?

There is this AUR package gcsf which works great. However I don't want to remount the drive manually after every reboot and would like this to happen automatically. Moreover when I do this manually the script must remain running in the terminal window and I can't kill it or it will terminate the program. So I would like this script to run in the background without any GUI attachment or visibly open terminal window.

Added a file "~/.config/autostart-scripts/googledrive"
with content:
gcsf mount ~/googledrive -s deemon

gave it +x with chmod

it does show up in Settings => Startup and Shutdown => Autostart => under scripts as Enabled and run on startup.

however it doesn't seem to have any effect and the mounting does not happen.
(when I run the script from command line manually, it works perfectly.)

What am I doing wrong? :blush:
Or is there a better way (create service for it?) to make the mount happen automatically at login?

Check the logs to see what is preventing from doing this task.

I can move it. Don't need to create a new one.

1 Like

From terminal
gcsf login deemon
That will prompt you for authorization, then create the credential file gcsf.toml in it's place.
then run
gcsf mount ~/googledrive -s deemon

In KDE Plasma is better to make use of *.desktop files inside ~/.config/autostart to have something running automatically.
Call it as you like it, gcsf.desktop would work.
For you it means should be like this:

[Desktop Entry]
Name=googledrive mount
Icon=googledrive
Exec=gcsf mount ~/googledrive -s deemon
Terminal=false
StartupNotify=true
Type=Application
X-KDE-SubstituteUID=false

or instead of Exec=gcsf mount ~/googledrive -s deemon
to point to the script you have
Exec=/home/deemon/.config/autostart-scripts/googledrive.sh

4 Likes

Thank you very much! Now it works perfectly. :smile:
used the Exec=gcsf version for simplicity and for no additional files needed.

Although there is this "StartupNotify=true" I didn't see any notifications about it starting up. Where should it output this?

Not quite sure if is creating a notification automatically or not, or you have to create one, manually by adding a file in ~/.local/share/knotifications5/ and call it for instance gcsf.notifyrc and add this lines to it:

[Global]
IconName=googledrive
Comment=Notification for googledrive mount
[Event/startup]
Name=gcsf mount
Comment=Your googledrive has been mounted
Action=
Sound=

Then in Notifications settings you chose more options.

Or maybe that line can be removed from the gcsf.desktop file :slight_smile:

Edit: i had to make some corrections.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by