How to run a any program (my case rclone) with parameters at login? (XFCE, or others if it's similar)

Hey there,

I didn’t know if anybody knew a good way to run this command at the login of XFCE?

rclone mount gdrive: /run/media/greg/Files/gDrive/ &

I also use the fish shell myself, but I have noticed that the shell is not running interactively and it’s also not the login shell (even after using chsh -s /usr/bin/fish)

Thanks all! :smiley:

Hi :wave:

Best way would be adding it to ~/.profile then it should run on every login.

Would I just add the line as I have it written?

Yes it should just run all commands like normally in bash & Co at login.

Or use ~/.bash_profile (idk if fish has something simliar).

If you are using KDE Plasma you also could add your script in Manjaro Settings Manager - Start and Shutdown - Autostart - Add script…

In XFCE, go to the Settings Manager, click on “Session and Startup” (bottom right), second tab (“Application Autostart”), then Add.

You should be able to use any commandline parameters you want.

Since the user is in xfce, is this better than:

Not knocking the preference or wordage (I agree that’s my best way, edit the ~/.profile file and be done with it), just made me wonder if the xfce environment path of action has any pros being it is working within it as built. Are there any pros to using ~/.profile over the xfce way? Is this just two different ways to pet a kitten?

Since I generally use .bash_profile and .bashrc (and other .bash_something scripts which I manually source from those two files), I’m not sure how .profile is read, and whether it’s read by the DE or Xorg itself, and whether all DEs treat it the same.

Oh wait, I actually have a .profile file! I didn’t realize that!

What does it say?

$ cat .profile
export EDITOR=/usr/bin/nano
...

YOU HEATHEN!!! DELETE!!!

1 Like

As i know ~/.profile works in any DE and even without.
The autostart apps in the DEs work only if the specific DE where you configured it is executed.

1 Like

is launched at login. (obviously per-user and not system-wide)
There is also a hierarchy, it goes (in order of most important, sourcing first)
.bash_profile, .bash_login, .profile

If you want some history time … .profile is actually the oldest of them.
It comes from the older Bourne Shell
(bash being a bourne-compatible shell - AKA “bourne again shell” - it can read it)

2 Likes

Ok, but is it read upon the launch of the shell (bash/zsh), or when you log into the GUI?

Because you wouldn’t want to run rclone every time you open a terminal window.

Its for the shell.
Usually you would use it for something like environment variables … not for autostarting a program.
(unless there is a little command like echo "Hello Neo" whenever you start a terminal)

I thought it was “Wake up, Neo.” :wink:

2 Likes

hah. I still really only remember the red/blue pill lines roughly … and I imagine it in one of those old flash animations … ugh … so old …

Ah, makes sense, this would be a preferable method for a user with multiple environments and one user. Or for more general env variables.

Using the xfce built-in method, makes a .desktop file which may provide easier implementation of some things. And would only be launched when user is loading xfce environment (which could probably be modified to work for various environments within the . desktop file if needed/desired). (Following the freedesktop specifications linked below by @cscs)

https://docs.xfce.org/xfce/xfce4-session/advanced

${XDG_CONFIG_DIRS}/autostart/
This is the location where the list of applications that should be automatically run on login is stored. Each autostarted application is represented by a .desktop file (see the Desktop Entry Specification for details).

Interesting knowledge to me.

https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html
:wink:
(and for you loons at there here is IBM on .profile and more: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/osmanagement/prof_file.html)

1 Like

Yeah man, I remember spending a lot of time on the websites for the Matrix, The Fifth Element, and The Pretender (NBC series). Fun times, the late nineties. :wink:

also ~/.config/autostart

1 Like

Well, I did try at least half of the suggestions that you guys tried, including the “Session and Startup”. I don’t have KDE, I use xfce, and I also use the fish shell, so the bash_profile wouldn’t work.

However, the suggestion by megavolt did work for me.

Thanks everyone! :smiley:

1 Like

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