Startup folder - what order of actions?[Solved]
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.
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, 17:28, edited 1 time in total.
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.
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
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]
[url=http://tinyurl.com/pxzq8o9][img]https://s17.postimg.cc/tl19y14y7/You_Tube_signature80px.png[/img][/url]
[url=http://tinyurl.com/kennels2/]Kennels[/url]
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:
I just checked for sure and the output is alphabetical.
Greetings!
It looks like:
Code: Select all
if [ -d /root/Startup ];then
for a in /root/Startup/*
do
[ -x "$a" ] && "$a" &
sleep 0.2
done
fi
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
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.SFR wrote:I just checked for sure and the output is alphabetical.
But that should work.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.
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?
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, 23:11, edited 2 times in total.
Correct.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.SFR wrote:I just checked for sure and the output is alphabetical.
=========
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: Select all
#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
---------
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: Select all
<StartupCommand>/path/to/command</StartupCommand>
Puppy Linux Blog - contact me for access
greengeek wrote:I want to action several scripts one after the other[...]
SFR wrote: [ -x "$a" ] && "$a" &
Good point!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.
@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!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
I sincerely hope there is no such thing!SFR wrote:--scripts with spaces in filename--
Puppy Linux Blog - contact me for access
Not script itself, but...01micko wrote:I sincerely hope there is no such thing!SFR wrote:--scripts with spaces in filename--
http://www.murga-linux.com/puppy/viewto ... 359#653359
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
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.
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.
Puppy Linux Blog - contact me for access
.
Wow, thank you all for the feedback!
http://www.murga-linux.com/puppy/viewto ... 0&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...)
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.
Wow, thank you all for the feedback!
The PXE server is complete (at least my first attempt at it is done) see here:sunburnt wrote:P.S. What`s your thoughts on a PXE server?
http://www.murga-linux.com/puppy/viewto ... 0&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...)
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.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.
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.
Thank you both for clarifying that. That will make it easy to trial the outcome of various startup scripts.sunburnt wrote:My experience is that the order is alphabetic, numbers first.
0_script1
1_script2
2_script3
Hmmm, I will have to be careful with that.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.
How long will those delayedrun processes stick around? Do they ever terminate?technosaurus wrote:Actually, /root/Startup is a bad idea and implemented wrong anyway. It spawns new processes of delayedrun which linger, eating valuable memory.
I am assuming WM is window manager, but I what is DE?Note that a more efficient way to do this is to let your WM/DE handle this
Ok, I’m getting the feeling it’s a bad idea if I put spaces in the filename of a script??technosaurus wrote:I sincerely hope there is no such thing!SFR wrote:--scripts with spaces in filename--
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..)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.
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.
Yup, it's not a good practice indeed...greengeek wrote:Ok, I’m getting the feeling it’s a bad idea if I put spaces in the filename of a script??technosaurus wrote:I sincerely hope there is no such thing!SFR wrote:--scripts with spaces in filename--
Until I saw that, I was ready to echo Mick's:
My point was that it happens anyway.I sincerely hope there is no such thing!
Have a good day & Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
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?SFR wrote:Until I saw that, I was ready to echo Mick's:My point was that it happens anyway.I sincerely hope there is no such thing!
Nothing. But you may find that your conscience will get the better of you.greengeek wrote:What will happen if I DO have a space in the filename?
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).
Puppy Linux Blog - contact me for access
One of the things I want to do is run a script to connect wireless in pUPnGO. I've got it working by placing my script in /startup but was hoping to get it actioned earlier during the boot.01micko wrote: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.
http://208.109.22.214/puppy/viewtopic.p ... &start=136
You mentioned the rc.local file but this pUPnGO does not seem to have one.
Any suggestions about where to put the wireless script so as to connect early but without undue risk?
Oh yeah. Duh. How'd i miss that?? Any chance of posting your rc.local in the pupngo2012 topic so I can work out where best to put my script? cheersKeef wrote:pupngo does have rc.local in etc/rc.d/
I start my own wifi startup script from there and it works fine.
@8-bit:Underscore sounds good. Will do. Making long descriptive filenames with spaces is a bad habit of mine unfortunately. Thx.