You are not logged in.

#1 2024-07-22 05:36:16

rayu
Member
Registered: 2024-07-22
Posts: 7

Running script on login

Hello all,

I freshly installed Arch Linux with KDE plasma 6 desktop environment and I was setting up a script to work on login. It keeps giving me error saying it failed. I put the .sh file in ~/.config/autostart but that did not work either. I would like the script to work before I login if possible if not then after login is also fine. I have also tried doing chmod +x to make it executable but that did not help either.

Can someone help me to setup autostart script on login. Thank you!!

Last edited by rayu (2024-07-22 05:37:08)

Offline

#2 2024-07-22 06:18:31

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: Running script on login

~/.config/autostart/ is part of the XDG autostart specification, which relies on .desktop files: https://specifications.freedesktop.org/ … atest.html

You should probably share your script here if you need further assistance.


Jin, Jîyan, Azadî

Offline

#3 2024-07-22 17:41:11

rayu
Member
Registered: 2024-07-22
Posts: 7

Re: Running script on login

Its just a basic rclone mounting script:

rclone --vfs-cache-mode writes mount onedrive: ~/OneDrive & notify-send "Onedrive Connected" "Microsoft Onedrive successfully mounted"


How do I make this run on login or on laptop startup?

Offline

#4 2024-07-22 17:49:42

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: Running script on login

You could use the XDG autostart system for that, just call the script in the Exec line.

I have some .desktop files you could use for inspiration here (they're for Debian so just ignore the dpgk-reconfigure commands and consider them as examples only).

Another possibility would be a systemd service but that would be a bit more involved.


Jin, Jîyan, Azadî

Offline

#5 2024-07-22 17:58:27

rayu
Member
Registered: 2024-07-22
Posts: 7

Re: Running script on login

Is there a documentation page for XDG autostart system? I am new on linux and don't know much about this. Thank you!

Offline

#6 2024-07-22 18:02:19

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: Running script on login

I linked to it in my first post in this thread.


Jin, Jîyan, Azadî

Offline

#7 2024-07-22 18:10:25

rayu
Member
Registered: 2024-07-22
Posts: 7

Re: Running script on login

Thank you so much! It finally worked. I just put the .desktop file in /etc/xdg/autostart folder. It did disappear after a reboot but the script is still working. Should I be concerned over that?

Offline

#8 2024-07-22 18:13:09

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: Running script on login

It's probably better to use ~/.config/autostart/. The script appears to be for your own user so running it system-wide doesn't seem appropriate.

What do you mean by "it did disappear after a reboot"?


Jin, Jîyan, Azadî

Offline

#9 2024-07-22 18:15:11

rayu
Member
Registered: 2024-07-22
Posts: 7

Re: Running script on login

Like the .desktop file is not in /etc/xdg/autostart/ folder anymore. But onedrive is still mounted. I don't understand whats going on.

Offline

Board footer

Powered by FluxBB