Forum › Forums › New users › New Users and General Questions › Doubt about IceWM startup
- This topic has 10 replies, 4 voices, and was last updated Dec 5-9:17 am by Xecure.
-
AuthorPosts
-
November 23, 2021 at 7:38 pm #71603
Anonymous
I put some stuff in IceWM startup ($HOME/.icewm/startup).
It works, albeit I observed that, if restarting IceWM or logging out and back in, I now have *two* instances of each thing (scripts, commands…) startup runs. At least according to “top” command.
Which means that, by restarting IceWM session, previous startup commands are not reset, but still running.Is there some way to fix it? To make that when restarting session all stuff in startup is also reset, so to have always only one instance of them.
Already searched man page of IceWM, found nothing explicit…Thanks beforehand.
November 23, 2021 at 10:05 pm #71614MemberPPC
::That never happened to me, as far as I noticed…
Try putting your scripts/app in ~/.desktop-session/startup instead, and see how it goes…P.
November 24, 2021 at 4:48 am #71627Anonymous
::Thanks very much!
By putting them there there were no more duplicated tasks in “top” command or “lxtask” application.Just one doubt:
in the AntiX wiki, in the “Desktop Session” page, it says that all stuff put in desktop-session startup must end with “&” (which means to be run in background).
The stuff I put is a small while loop; I first tried putting it just as it is (after noticing first command in default startup has no “&” at the end), and seemed to work…
Could I leave it like that, or better to enclose whole loop in “()” and end it with “&” ?
What could be the difference?Thanks again.
November 24, 2021 at 7:53 am #71633Member
Xecure
::It is better to save the loop inside a separate script and call it from startup.
For example$HOME/scripts/my-loop.sh &
where my-loop.sh is a file containing your instructions with executable permissions. It could look like:#!/bin/bash while true; do echo "check battery" acpi sleep 120 done- This reply was modified 1 year, 5 months ago by Xecure.
antiX Live system enthusiast.
General Live Boot Parameters for antiX.November 24, 2021 at 1:11 pm #71645Anonymous
::It is better to save the loop inside a separate script and call it from startup.
Thank you. That’s a good tip / reminder.
November 24, 2021 at 6:32 pm #71671Anonymous
::Thanks.
So that’s the better practice.
Though on first time I did it like putting loop raw code at the end of startup…
Could there be consequences at mid/long term if doing it like this?November 27, 2021 at 11:27 pm #71825Anonymous
::Also, must I really make all stuff put here (either scripts or commands) to run on background? I.e., ending all of them with a “&” character.
Thanks.December 4, 2021 at 8:20 pm #72278Anonymous
::I apologize beforehand; but after looking for more info about “desktop-session” in general around internet, I found little to nothing. Mostly references to the forum here precisely.
I’d like trying to ask just once more, in case anyone could help or have an idea.
—Can there be consequences by putting raw code in desktop-session startup?
—Must I really make all stuff in here to run on background (ending them with “&” character)?Thanks beforehand again.
December 4, 2021 at 9:20 pm #72282Member
Xecure
::If the commands you add terminate and don’t continue running (like a simple check, or changing a file’s content, or enabling/disabling options), then you don’t need to fork it with the & character at the end of the line. If it launches a program that continues to run (like a toolbar, the volume-icon, etc), if you don’t fork it it will stop the desktop session to continue its work.
You can add all the amount of code you want, with loops or conditions or whatever, as long as you expect them to finish so that the rest of the file is read.
The startup file is sourced by desktop-session just after the window manager starts (with a X seconds session delay set by STARTUP_DELAY in the desktop-session.conf file). This means that it will read one line at a time, as if running a bash script. If the script stops at one point and doesn’t continue “down the script”, because it got stuck by a command that didn’t fork, then all commands after that line will not run.
We recommend using the & symbol to fork all the startup commands just in case (better safe than sorry), but if you have good bash and shell programming knowledge, you can do as you want there.
antiX Live system enthusiast.
General Live Boot Parameters for antiX.December 5, 2021 at 2:14 am #72293Anonymous
::Thanks very much sir.
The stuff I’m putting is a small –yet indeed constant– while loop, involving Yad app to use as notifications.
As previously mentioned, I first put this block “raw” as it is, without “&” at the end, but at the very end of file.Is this why I seemingly noticed nothing wrong? By a “coincidence”?
And no, sadly I’m no Bash expert at all…Thanks again.
December 5, 2021 at 9:17 am #72305Member
Xecure
::As previously mentioned, I first put this block “raw” as it is, without “&” at the end, but at the very end of file.
Is this why I seemingly noticed nothing wrong? By a “coincidence”?
Correct. If it is placed at the end of the file, then everything else has already loaded so no worries here.
antiX Live system enthusiast.
General Live Boot Parameters for antiX. -
AuthorPosts
- You must be logged in to reply to this topic.