You are not logged in.

#1 2016-03-15 19:33:46

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Preferences on Auto-Starting Scripts/Processes

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

#2 2016-03-15 19:53:42

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Preferences on Auto-Starting Scripts/Processes

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 big_smile

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.

[1] https://github.com/Head-on-a-Stick/conf … 40.service

[2] https://github.com/Head-on-a-Stick/conf … hs.OpenBSD

Offline

#3 2016-03-15 20:31:08

tknomanzr
BL Die Hard
From: Around the Bend
Registered: 2015-09-29
Posts: 1,057

Re: Preferences on Auto-Starting Scripts/Processes

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

#4 2016-03-15 20:56:43

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Preferences on Auto-Starting Scripts/Processes

yikes  You can start files on boot!!  yikes



lol  lol 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

#5 2016-03-15 21:53:28

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Preferences on Auto-Starting Scripts/Processes

Sector11 wrote:

yikes  You can start files on boot!!  yikes

yikes I know! Here I was starting each program with my crank and rodent wheel!!   big_smile

@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

#6 2016-03-15 22:01:53

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Preferences on Auto-Starting Scripts/Processes

Horizon_Brave wrote:

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

#7 2016-03-15 22:05:48

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Preferences on Auto-Starting Scripts/Processes

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 wink

Offline

#8 2016-03-15 22:17:58

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Preferences on Auto-Starting Scripts/Processes

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

#9 2016-03-15 22:20:21

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Preferences on Auto-Starting Scripts/Processes

Sector11 wrote:

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 smile

Last edited by Head_on_a_Stick (2016-03-15 22:21:43)

Offline

#10 2016-03-15 22:24:00

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Preferences on Auto-Starting Scripts/Processes

Head_on_a_Stick wrote:
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 wink


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

#11 2016-03-15 23:56:46

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Preferences on Auto-Starting Scripts/Processes

Head_on_a_Stick wrote:

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 smile

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

#12 2016-03-19 00:12:22

spacex
Member
From: Norway
Registered: 2015-12-15
Posts: 66
Website

Re: Preferences on Auto-Starting Scripts/Processes

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 smile


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

#13 2016-03-19 05:39:51

ohnonot
...again
Registered: 2015-09-29
Posts: 5,592

Re: Preferences on Auto-Starting Scripts/Processes

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

#14 2016-03-19 15:42:10

Sector11
Mod Squid Tpyo Knig
From: Upstairs
Registered: 2015-08-20
Posts: 8,028

Re: Preferences on Auto-Starting Scripts/Processes

Sector11 wrote:

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

#15 2016-03-19 21:01:55

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Preferences on Auto-Starting Scripts/Processes

Sector11 wrote:

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

Board footer

Powered by FluxBB