4.6.2 early report

Duncan 1i5t5.duncan at cox.net
Mon Apr 11 04:11:53 BST 2011


gene heskett posted on Sun, 10 Apr 2011 22:18:11 -0400 as excerpted:

> That isn't where these need to be, they should start a few seconds after
> kmail has been started.

That's simple enough.  Use sleep to delay, either alone with relatively 
dumb trial and error to determine how long, or with something like pgrep 
kmail in a loop, to see when kmail starts, and then another arbitrary 
delay after that to let kmail stabilize.  The script can then go in the 
usual startup location and spend most of its time sleeping, until kmail 
has time to come up.

With sleep, delays are never a problem, tho getting the length of the 
delay timed well enough to consistently have whatever it is you are 
waiting for happen first, without waiting far longer than necessary in 
most cases, /can/ be a bit of a challenge.  Here, pgrep in a delay loop of 
say one second is a convenient enough tool to detect when kmail starts, 
but one must still more or less guess at how long it takes to stabilize 
before one can run whatever it is you're intending to run.

Of course, if it's something that you're not actively waiting on, the time 
constraints tend to be rather less critical, and a simple sleep 
30/60/90/120/300/whatever may well suffice.

(I'd call myself an intermediate shell (bash) scripter, as I do a 
reasonable amount of it both for my own use and occasionally for public 
use or in public bugfiling, as of gentoo initscript bugs, for instance, 
but like many intermediate users, I have enough knowledge on the topic to 
realize there's way more I don't know, and thus don't consider myself an 
expert.  Use of sleep for a simple, dumb delay is beginner level shell 
scripting, creating a sleep loop with some sort of detection is arguably 
advanced beginner if not intermediate, with knowing about pgrep for that 
detection is probably intermediate, while advanced beginner level would 
use ps piped to grep. =:^)

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list