Tiny Core Linux
Tiny Core Extensions => TCE Q&A Forum => Topic started by: andyb1973 on May 13, 2022, 01:02:04 PM
-
best and fastest way to start up a sh?
i used /opt/bootlocal.sh but it seems not to fast as i thought
thx
ab
-
Hi andyb1973
The question is too vague to answer due to the way it was ask and the lack of detail to what you are doing.
... fastest way to start up a sh? ...
The earliest practical place to launch a script is from /opt/bootsync.sh.
The fastest way to execute a script is highly dependent on what the script is doing and how it is written.
If you attach a copy of your /opt/bootlocal.sh and the script you are launching, we can better answer your question.
-
i try
@ the beginning (before ssh server and the trottler of cpu i think) of bootlocal, i placed my "/opt/nav.sh &" (ok, nice answer)...
ok, my sh makes:
1. launch usbmode switch with parameters (i need to tranform my gsm key): the light of the gsm key changes
2. lanch ppp to connect gsm (a loop in & to recatch the carrier if needed) ..depends where is my key
3. lanch ping to discover network (a loop without &) .. time.. depends
4. end: a loop reading gps key with readline and a curl to fixed ip to send coordinates (depends by the point 3)
it seems the script is called after a little bit.. the prompt is ready, but i see gsm change after more or less 30 seconds (a sensation based upon the change of the blinkiing light on gsm key .. also the strout on prompt seems to lanch after time)
maybe can i put my sh in a better place (or create a service?)? another note: i leave 40-usbmodeswitch in /etc/udev/roles.d/, maybe usb is parsing all of them taking time?
thanks
-
Hi andyb1973
As Rich said your question is vague. If you need to start your script earlier you may want to look at /etc/init.d also look at /etc/init.d/tc-config to see what starts up from there, and maybe modify tc-config. You mentioned PPP and Ping which would require Ethernet so may want to look after eth and usb devices (for GSM key) have started.
Probably the order to look at for places to place your script is init.d > rcs > tc-config > bootsync.sh > bootlocal.sh
Cheers
-
You can add logging to your script to see when things happen. It doesn't sound like starting it earlier would help much, rather some steps in it are taking the time.
-
Hi andyb1973
As Rich said your question is vague. If you need to start your script earlier you may want to look at /etc/init.d also look at /etc/init.d/tc-config to see what starts up from there, and maybe modify tc-config. You mentioned PPP and Ping which would require Ethernet so may want to look after eth and usb devices (for GSM key) have started.
Probably the order to look at for places to place your script is init.d > rcs > tc-config > bootsync.sh > bootlocal.sh
Cheers
aorry, i'm newbie, but if i make e sh in init.d (not a service) is allowed?
-
Hi andyb1973
I think the place to start is the execution time of your script.
Comment out /opt/nav.sh & from your bootlocal.sh file.
Reboot your machine and run sections of /opt/nav.sh one at a time and see which ones are taking too long.
Once you have /opt/nav.sh running satisfactory from the command line, re-enable it in bootlocal.sh.
If it's slow again, then something else is causing that.
I've attached a file with a timestamp function you can use for logging elapsed time.
Place the contents before your code in your /opt/nav.sh script.
Everytime you call Timestamp , it will print the elapsed time since the last call to Timestamp.
You can include a message to be printed next to the elapsed time like this:
Timestamp "launch usbmode switch"
# Your usbmode code
Timestamp "launch ppp to connect gsm"
# Your ppp code
-
thx
-
Hi andyb1973
As Rich said your question is vague. If you need to start your script earlier you may want to look at /etc/init.d also look at /etc/init.d/tc-config to see what starts up from there, and maybe modify tc-config. You mentioned PPP and Ping which would require Ethernet so may want to look after eth and usb devices (for GSM key) have started.
Probably the order to look at for places to place your script is init.d > rcs > tc-config > bootsync.sh > bootlocal.sh
Cheers
for donkey like me, but how register a new init.d/example.sh without update-rc or systemd ?
thx
-
Not sure but guessing you want to use a USB gateway device to connect to a GSM network?
So, guessing the order is:
1 USB is required first check if device is available.
2 If device is available get GSM key.
3 If GSM key retrieved Set PPP authentication.
4 Check if can reach the net.
If this is the case then, as the udev daemon is started in the etc/init.d/tc-config so no use setting your script in init.d so believe your question isn’t relevant to your solution.
As Curaga suggested placing earlier then bootlocal.sh or bootsync.sh would probably not help. As mentioned, logging/timestamping is your best option, maybe create a script that checks usb device first then go from there.