Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 28 Aug 2014, 09:44
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Startup folder - what order of actions?[Solved]
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
greengeek

Joined: 20 Jul 2010
Posts: 2496
Location: New Zealand

PostPosted: 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.

Edited_time_total
Back to top
View user's profile Send_private_message 
ETP


Joined: 19 Oct 2010
Posts: 535
Location: UK

PostPosted: 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
Accessibility Pups: -- Magoo -- The Pup With No Name -- MouseCam -- Obedient
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1063

PostPosted: 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
View user's profile Send_private_message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9058
Location: Stratford, Ontario

PostPosted: 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
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: 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?

Edited_times_total
Back to top
View user's profile Send_private_message 
01micko


Joined: 11 Oct 2008
Posts: 7794
Location: qld

PostPosted: 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.

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send_private_message Visit_website 
SFR


Joined: 26 Oct 2011
Posts: 1063

PostPosted: 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! Embarassed Cool

@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
View user's profile Send_private_message 
01micko


Joined: 11 Oct 2008
Posts: 7794
Location: qld

PostPosted: Wed 10 Oct 2012, 19:36    Post_subject:  

SFR wrote:
--scripts with spaces in filename--

I sincerely hope there is no such thing!

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send_private_message Visit_website 
SFR


Joined: 26 Oct 2011
Posts: 1063

PostPosted: 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
View user's profile Send_private_message 
01micko


Joined: 11 Oct 2008
Posts: 7794
Location: qld

PostPosted: Wed 10 Oct 2012, 20:01    Post_subject:  

SFR

That is BAD! Laughing

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.

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send_private_message Visit_website 
greengeek

Joined: 20 Jul 2010
Posts: 2496
Location: New Zealand

PostPosted: 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
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1063

PostPosted: 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. Rolling Eyes

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
View user's profile Send_private_message 
greengeek

Joined: 20 Jul 2010
Posts: 2496
Location: New Zealand

PostPosted: 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. Rolling Eyes

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
View user's profile Send_private_message 
01micko


Joined: 11 Oct 2008
Posts: 7794
Location: qld

PostPosted: 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[!] Shocked ..probably why my wife likes her Mac, her name is Kriista.. yes 2 "i" 's, (no spaces though).

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send_private_message Visit_website 
greengeek

Joined: 20 Jul 2010
Posts: 2496
Location: New Zealand

PostPosted: 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...
Smile
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1052s ][ Queries: 12 (0.0035s) ][ GZIP on ]