[Solved] Script at login, where to?


#1

Hi all, I want to execute a script at login time, where should I put it, in my i3 config, in my .xprofile or .xinitrc ?
What the appropriate way to do so ?


#2

I put mine in my i3 config. As an example, my conky is of course executed everytime I boot with

exec --no-startup-id conky -c ~/.config/conky/quodlibet.conkyrc


#3

Depends on when you want it launched and how you login really.

If you want it to run before the wm and regardless of which wm, the best way would be:

  • for xinit ~/.xinitrc
  • for lightdm ~/.xprofile

If you don’t care about when it runs and only use one wm and you wm supports startup commands of some kind then you can just put it there, like what @Dobbie03 said.


#4

Ok guys thx, i will come back to tell you if either way worked, when i will restart.


#5

Well in fact i’d like to apply some kernel variables with sysctl but I know that

/etc/sysctl.conf

…is depreciated so instead of command line

sudo sysctl -p /some/config/sysctl.conf

I just wanted a script so I do not have to worry. As I said, I’ll see at reboot but I have a doubt about the ‘sudo’ part.


#6

Use individual files in /etc/sysctl.d/ instead.

You can also use the kernel command line to apply sysctl values.

https://wiki.archlinux.org/index.php/sysctl#Configuration


#7

In that case

http://0pointer.de/public/systemd-man/sysctl.d.html

But personally I just use my boot to set kernel values, depends on which bootloader you use but it’s always after the kernel param.

For grub set the GRUB_CMDLINE_LINUX_DEFAULT=...... variable in /etc/default/grub.
For systemd-boot set options root=LABEL=XXXXX ...... rw in your loader configuration, usually /boot/loader/entries/XXX/XXX.conf
For syslinux set the APPEND root=XXX .... rw line in/boot/syslinux/syslinux.cfg

For no bootloader

efibootmgr -v -d /dev/sdX -p 1 -c -L 'ArchLabs' -l /vmlinuz-linux \
-u 'root=PARTUUID=XXXXXX quiet loglevel=3 vga=current nowatchdog rw initrd=\intel-ucode.img initrd=\initramfs-linux.img'

The above is what I currently use and you can see I’m passing things like nowatchdog and quiet as part of the -u flag.


#8

alright guys I will use what Head_on-a_Stick proposes for now because GRUB is a bit ticklish. I knew about /etc/sysctl.d/ but it’s better when some arch users confirm what you thought.
Anyways thanks dobbie, natemaia and Head_on_a_Stick (funny nickname) :blush: