You are not logged in.
Hey all... So I know (have come to painfully learn lol..) that options are the foundation of any linux distro worth it's salt. So my questions/poll, is what is everyone's favorite method to getting a program to start on boot? It seems to me ( reading prior posts) that the preferred method for this to put a line in the ~/.config/openbox/autostart (or /etc/xdg/autostart) sourcing or execing the file script you wish to run.
There are other methods though, such as creating a Cron job to run at a certain time, though this seems not to work well if you want it run strictly at boot time.
We also have the option to run it as a .service file for us systemd users. We could create a unit file, flesh it out with what script we want run and a whole bunch of customized parameters that provision when, how, depending on what other scripts or services etc..
And we can put a line in our ~/.profile or /etc/profile.d/ to run any script when it's read at boot time.
So my main question is, what method does everyone prefer? Is this based on personal preference? or how you want the script to be run? Any advantages to doing it with one method over the other?
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
For internet connections, I use either systemd-networkd or a custom unit file [1] for systemd.
I don't like abstraction in my network so NetworkManager (or WICD) is right out
I also use systemd to discard unused blocks on my SSD once a week with fstrim.timer and start a firewall at bootup using nftables
For autostarting programs on the desktop, I use ~/.xinitrc for my current window manager (PekWM):
xfce4-power-manager
urxvtd -q -f -o
xset s 300 -dpms
volumeicon &
tint2 &
compton --backend glx --vsync opengl-mswc &
sh ~/.fehbg
exec pekwm
PekWM does have ~/.pekwm/start which can be used in the same way as ~/.config/openbox/autostart but I prefer to use .xinitrc as that method works with all window managers.
This file is parsed by the `startx` command which is run automatically after a (console) login by this line in ~/.zprofile (this would be ~/.bash_profile for BASH users):
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx #/usr/bin/xmonad
For my XMonad desktop, I compile the startup programs into the xmonad binary with the startupHook in xmonad.hs [2] and then simply un-comment the "/usr/bin/xmonad" bit in ~.zprofile to start the desktop, no ~/.xinitrc or other startup scripts are needed with this approach.
I favour simplicity as it makes things easier to fix.
/etc/xdg/autostart is only used by display managers so I never bother with it.
Offline
Depends if it is desktop related or system related. I prefer system level stuff to be handled by systemd. I have made a little progress with systemctl --user level stuff but am nowhere near ready to pull up an entire desktop with it yet. FWIW, after much struggling, I have figured out that all mount related stuff, whether physical or network related mounts, are best handled by /etc/fstab. All entries there get converted into proper systemd unit files anyway.
Offline
You can start files on boot!!
Just kidding - it's the noob in me. And because it's the noob in me it's obvious:
~/.config/openbox/autostart
for this old man.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
You can start files on boot!!
I know! Here I was starting each program with my crank and rodent wheel!!
@HoaS
Great post HoaS, no surprise there of course... I agree with you 100% with NetworkManager, I really am getting tired of it's rather invasive and heavy handed management.
And the abstraction level bothers me as well... One of my other posts touches on this. I definitely don't mind options and easy management, but there's so so many layers of tools using tools, to configure tools to write configs...
Anyway, so you're saying that using ~/.xinitrc for sourcing your scripts, makes it easier to then "port" it over if you change window manager/desktop manager?
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
so you're saying that using ~/.xinitrc for sourcing your scripts, makes it easier to then "port" it over if you change window manager/desktop manager?
Yes, exactly.
I can just change "pekwm" to "openbox" or swap "tint2" for "xfce4-panel" or whatever, its very flexible.
Offline
And the abstraction level bothers me as well... One of my other posts touches on this. I definitely don't mind options and easy management, but there's so so many layers of tools using tools, to configure tools to write configs...
You should try Arch
Offline
I don't have an ~/.xinitrc file but that sound interesting for people that distro-hop, wm-hop.
What about DE's can one use ~/.xinitrc with different DE with the same success rate?
I've stopped testing things of late ... have enough on my plate at the moment.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
What about DE's can one use ~/.xinitrc with different DE with the same success rate?
No, that file is not used by any display managers (or desktop environments).
For LightDM, you can use ~/.xsession instead and select "Default Xsession" in the session menu on the logoin screen to run that file.
EDIT: Welcome back S11, good to see you're OK
Last edited by Head_on_a_Stick (2016-03-15 22:21:43)
Offline
Horizon_Brave wrote:And the abstraction level bothers me as well... One of my other posts touches on this. I definitely don't mind options and easy management, but there's so so many layers of tools using tools, to configure tools to write configs...
You should try Arch
Are you kidding, I'm barely hanging on to what i'm learning around these parts!
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
For LightDM, you can use ~/.xsession instead and select "Default Xsession" in the session menu on the logoin screen to run that file.
EDIT: Welcome back S11, good to see you're OK
Well, OK, no DE's. That's cool, I've not used one in years.
Taliking about LDM I was going to ask you about getting rid of it, but that's another post in a different thread. Tis' off topic here.
Thank you.
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
I'll always autostart as much as possible in ~/.config/openbox/autostart, as it is only one file to handle. Having something started by /etc/xdg/austostart is only confusing, and systemd is used as little as possible, so that my configs work just as well no matter what init system I use. If you want to do it the way HoaS does it, it means that you got to embrace Systemd, not just working around it, like most of us do
Regards Spacex(EW)
"If you have any trouble sounding condescending, find a UNIX user to show you how it's done." — Scott Adams, Dilbert Cartoonist
Offline
i think for system- and network-related stuff systemd is the way to go (on a system that uses it).
apart from that, i've been dithering between autostart and .xinitrc for a while.
for some time, i had an extensive .xinitrc, and only did an
exec openbox
in the end (notice, openbox, not openbox-session. autostart isn't even looked for, neither are some xdg scripts and the annoying make-the-background-grey feature).
then for a while i was starting X without a .xinitrc like this:
xinit /usr/bin/openbox --sm-disable --startup ~/.config/openbox/autostart -- -nolisten tcp vt$XDG_VTNR
i see no difference in performance.
for some autostarted programs, however, it seems better to start them when the window manager is already running, others better before that.
Offline
I don't have an ~/.xinitrc file but that sound interesting for people that distro-hop, wm-hop.
What about DE's can one use ~/.xinitrc with different DE with the same success rate?
I've stopped testing things of late ... have enough on my plate at the moment.
Boy am I ever dumb .. Dumber .. DUMBEST!
~/.config/.xinitrc {sigh}
Debian 12 Beardog, SoxDog and still a Conky 1.9er
Online
Boy am I ever dumb .. Dumber .. DUMBEST!
~/.config/.xinitrc {sigh}
Pftt, if I had a nickel for each time I've had the feeling. Trust me I'm still even trying to master the linux login / X11 boot process... The amount of files needed, and dependencies on certain dot files, and depending on how you login is just headache inducing. 8.(
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline