| Author |
Message |
greengeek
Joined: 20 Jul 2010 Posts: 1184 Location: New Zealand
|
Posted: Wed 10 Oct 2012, 15:21 Post subject:
Startup folder - what order of actions?[Solved] |
|
How does the operating system choose the "action order" of items placed in the /root/Startup folder? Does it decide based on alphabetical name, or file size/date or maybe some other determinant?
I want to action several scripts one after the other (but without writing them inside one single script).
If I can change the order of actioning just by changing the filename that would be quite easy.
Last edited by greengeek on Thu 25 Oct 2012, 13:28; edited 1 time in total
|
|
Back to top
|
|
 |
ETP

Joined: 19 Oct 2010 Posts: 306 Location: UK
|
Posted: Wed 10 Oct 2012, 15:39 Post subject:
Startup folder - what order of actions? |
|
Hi greengeek,
No idea about the order but you could just place one script in the folder who's
function is purely to call other scripts held outside the startup folder - a calling script.
You can then specify the order and include any necessary sleep commands.
_________________ Regards ETP
Currently running Slacko 5.3.3 k-3.1.10
(demo with audio--play flash full screen & press F11)
http://megaswf.com/s/2484946 1080p version Oct 2012
|
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 570
|
Posted: Wed 10 Oct 2012, 16:26 Post subject:
|
|
Not sure if it's utilized in the same manner in all Puppies, but in Slacko (and Lupu IIRC) the job is done by the end portion of "delayedrun" script in /usr/sbin.
It looks like:
| Code: | if [ -d /root/Startup ];then
for a in /root/Startup/*
do
[ -x "$a" ] && "$a" &
sleep 0.2
done
fi |
I just checked for sure and the output is alphabetical.
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
|
Back to top
|
|
 |
rcrsn51

Joined: 05 Sep 2006 Posts: 7745 Location: Stratford, Ontario
|
Posted: Wed 10 Oct 2012, 18:53 Post subject:
|
|
| SFR wrote: | | I just checked for sure and the output is alphabetical. |
But because the programs in Startup are being sent into the background, I don't think that you can guarantee that script #1 is completed before script #2 starts.
| Quote: | | but you could just place one script in the folder who's function is purely to call other scripts held outside the startup folder - a calling script. You can then specify the order and include any necessary sleep commands. |
But that should work.
|
|
Back to top
|
|
 |
sunburnt

Joined: 08 Jun 2005 Posts: 4001 Location: Arizona, U.S.A.
|
Posted: Wed 10 Oct 2012, 19:09 Post subject:
|
|
Hi greengeek; The one script idea is a good one.
My experience is that the order is alphabetic, numbers first.
So like this:
0_script1
1_script2
2_script3
P.S. What`s your thoughts on a PXE server?
Last edited by sunburnt on Wed 10 Oct 2012, 19:11; edited 2 times in total
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7017 Location: qld
|
Posted: Wed 10 Oct 2012, 19:09 Post subject:
|
|
| rcrsn51 wrote: | | SFR wrote: | | I just checked for sure and the output is alphabetical. |
But because the programs in Startup are being sent into the background, I don't think that you can guarantee that script #1 is completed before script #2 starts. |
Correct.
=========
Actually, /root/Startup is a bad idea and implemented wrong anyway. It spawns new processes of delayedrun which linger, eating valuable memory. Jamesbond solved this part. | Code: | #this goes in /usr/sbin/delayedrun
if [ -d /root/Startup ];then
for a in /root/Startup/*
do
if [ -x "$a" ];then $a & #jamesbond
fi
sleep 0.2
done
fi | That code is from the current slacko beta.
---------
Note that a more efficient way to do this is to let your WM/DE handle this and usually they require a special cutdown .desktop file, however, for JWM you can put entries like this in a file in $HOME/.jwm/jwmstartuprc and "include" it in your jwm startup routine. | Code: | | <StartupCommand>/path/to/command</StartupCommand> |
Trouble is, there are so many progs hard coded to /root/startup that this approach with Puppy becomes impractical.
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 570
|
Posted: Wed 10 Oct 2012, 19:28 Post subject:
|
|
| greengeek wrote: | | I want to action several scripts one after the other[...] |
| SFR wrote: | | [ -x "$a" ] && "$a" & |
| rcrsn51 wrote: | | But because the programs in Startup are being sent into the background, I don't think that you can guarantee that script #1 is completed before script #2 starts. |
Good point!
@Mick:
Are there any contraindications to double quote the second "$a", because as it is now, scripts with spaces in filename won't be executed?
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7017 Location: qld
|
Posted: Wed 10 Oct 2012, 19:36 Post subject:
|
|
| SFR wrote: | | --scripts with spaces in filename-- |
I sincerely hope there is no such thing!
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 570
|
Posted: Wed 10 Oct 2012, 19:42 Post subject:
|
|
| 01micko wrote: | | SFR wrote: | | --scripts with spaces in filename-- |
I sincerely hope there is no such thing! |
Not script itself, but...
http://www.murga-linux.com/puppy/viewtopic.php?p=653359#653359
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7017 Location: qld
|
Posted: Wed 10 Oct 2012, 20:01 Post subject:
|
|
SFR
That is BAD!
Not even MS Windows put spaces in their executable files, not the ones I've seen anyway.
I will not be wrapping $a in quotes to appease poor design.
-------------------------------------
greengeek
It would be helpful if you let us know what you want to start. There are more ways to start programs than the startup folder but they may depend on what else they need running to start.
You can start programs very early with a service script, which in Puppy are located @ /etc/init.d/ and started with a "start" parameter and stopped with a "stop" parameter and can have restart, reload, whatever other parameters depending on what they do. Similarly, these are executed in numerical, then alphabetical order.
You can also start stuff from /etc/rc.d/rc.local where in Puppy the firewall (if configured) gets started.
If you need something started that depends on network connectivity then you can construct a loop to detect when the net is up and start your proggy then. This can be done from any of the methods mentioned. You can do something similar if your proggy depends on X or rox or whatever.
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
greengeek
Joined: 20 Jul 2010 Posts: 1184 Location: New Zealand
|
Posted: Thu 11 Oct 2012, 05:11 Post subject:
|
|
.
Wow, thank you all for the feedback!
| sunburnt wrote: | | P.S. What`s your thoughts on a PXE server? |
The PXE server is complete (at least my first attempt at it is done) see here:
http://www.murga-linux.com/puppy/viewtopic.php?t=80620&start=13
I’ve set it up to offer Thin Slacko to any PC that requests a PXE load.
However, it taught me that there is a lot to learn about remastering, and I think there is some improvement needed, which has led to some of these other questions. (also that is the reason for the mnt-all2 code I was asking you about...)
| ETP wrote: | you could just place one script in the folder who's
function is purely to call other scripts held outside the startup folder - a calling script. |
Thanks. I will probably use this idea for some purposes. The downside that comes to mind is that it is not easy to spot what is going on just by having a quick look into the startup folder. It requires a closer look at the script each time I want to see what I have set up.
| SFR wrote: | Not sure if it's utilized in the same manner in all Puppies, but in Slacko (and Lupu IIRC) the job is done by the end portion of "delayedrun" script in /usr/sbin.
just checked for sure and the output is alphabetical. |
| sunburnt wrote: | My experience is that the order is alphabetic, numbers first.
0_script1
1_script2
2_script3 |
Thank you both for clarifying that. That will make it easy to trial the outcome of various startup scripts.
| rcrsn51 wrote: | | But because the programs in Startup are being sent into the background, I don't think that you can guarantee that script #1 is completed before script #2 starts. |
Hmmm, I will have to be careful with that.
| technosaurus wrote: | | Actually, /root/Startup is a bad idea and implemented wrong anyway. It spawns new processes of delayedrun which linger, eating valuable memory. |
How long will those delayedrun processes stick around? Do they ever terminate?
| Quote: | | Note that a more efficient way to do this is to let your WM/DE handle this |
I am assuming WM is window manager, but I what is DE?
| technosaurus wrote: | | SFR wrote: | | --scripts with spaces in filename-- | I sincerely hope there is no such thing! | Ok, I’m getting the feeling it’s a bad idea if I put spaces in the filename of a script??
| Quote: | | It would be helpful if you let us know what you want to start. There are more ways to start programs than the startup folder but they may depend on what else they need running to start. |
Actually I’m not totally sure yet exactly what I will need to run. I have been trying to remaster PupServer435 to add PXE server capability and I have discovered that various bits of functionality disappear when using the default remaster utility, so I have a need to force some scripts to run after booting. The real answer for me is to overcome the remaster problems, but using the startup folder seems to be a suitable short-term way to re-introduce the functions I have lost (which seems to include usb detection and automount for some devices..)
My final goal is to have a lightweight server (including PXE server ability) which will run ok on the older laptops that I find no longer have enough grunt to be good web surfing machines. (In particular one of these servers will be solar powered - booting itself when the sun comes up and going to sleep when the batteries go flat after dark). I want to trial various puppies as a base, and various puppies as the PXE offering. Once I have sorted out how to remaster properly I hope to make a whole stable of HomeFileserver/PXE pups which self-start without human intervention.
|
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 570
|
Posted: Thu 11 Oct 2012, 06:51 Post subject:
|
|
| greengeek wrote: | | technosaurus wrote: | | SFR wrote: | | --scripts with spaces in filename-- | I sincerely hope there is no such thing! | Ok, I’m getting the feeling it’s a bad idea if I put spaces in the filename of a script?? |
Yup, it's not a good practice indeed...
Until I saw that, I was ready to echo Mick's:
| Quote: | | I sincerely hope there is no such thing! |
My point was that it happens anyway.
Have a good day & Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
|
Back to top
|
|
 |
greengeek
Joined: 20 Jul 2010 Posts: 1184 Location: New Zealand
|
Posted: Fri 12 Oct 2012, 04:25 Post subject:
|
|
| SFR wrote: | Until I saw that, I was ready to echo Mick's:
| Quote: | | I sincerely hope there is no such thing! |
My point was that it happens anyway. |
What will happen if I DO have a space in the filename? Will it still run ok if it is a "standalone" script? Does the space only cause problems if the script is "called" by some other script/programme?
|
|
Back to top
|
|
 |
01micko

Joined: 11 Oct 2008 Posts: 7017 Location: qld
|
Posted: Fri 12 Oct 2012, 04:40 Post subject:
|
|
| greengeek wrote: | | What will happen if I DO have a space in the filename? |
Nothing. But you may find that your conscience will get the better of you.
The only acceptable instances of spaces in filenames are names of actual files that are used by a program, say an mp3 file, an avi file a document. But still this can be a pain in the a*se even in Windows. Whenever that file is called it will always have to be wrapped in quotes. The genii at MS even decide to put spaces in directory, sorry "folder" names to trip even themselves up.
And forget Mac devs.. do you believe they put spaces in the filename of network shares? They do. we'll give them an extra i, geniii[!] ..probably why my wife likes her Mac, her name is Kriista.. yes 2 "i" 's, (no spaces though).
_________________ keep the faith .. 
|
|
Back to top
|
|
 |
greengeek
Joined: 20 Jul 2010 Posts: 1184 Location: New Zealand
|
Posted: Fri 12 Oct 2012, 14:43 Post subject:
|
|
Two "ii"s is tolerable I suppose, but 3 "iii"s is just darn pretentious. Actually, maybe even two ii's is a little bit pretentious...
|
|
Back to top
|
|
 |
|