Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: jrm7262 on February 05, 2025, 07:26:46 AM
-
Hello all,
I can get lighttpd running manually and at boot via bootlocal.sh
I can get bftpd running manually and at boot via bootloader.sh
But when I put them both in bootlocal.sh only whichever is first runs.
I can get them running together manually.
Tried with and without & and &&.
Any ideas on this odd behaviour?
Perfectly open to the idea I'm missing something very simple.
Kindest regards
James ❤️🖖
-
bootlocal.sh runs commands as root
did you try forcing it to run as tc user?
sudo -u tc mycommand
-
Strange problems like this are sometimes due to a race condition. Does adding sleep 1 to bootlocal.sh (between lighttpd and bftpd) help?
-
Thank you for the replies.
I will try sleep (and wait).
How do I force bootlocal to run a command as tcuser?
J❤️🖖
-
by prepending sudo -u tc ... to the command
-
🙂👍
-
Hi jrm7262
... I will try sleep (and wait). ...
When I saw that, I thought to myself "there's no wait command".
Then I figured better ask the interweb and found it was a shell builtin.
Sure enough, there it is at the end of the list:
tc@E310:~$ help
Built-in commands:
------------------
. : [ [[ alias bg break cd chdir command continue echo eval exec
exit export false fg getopts hash help history jobs kill let
local printf pwd read readonly return set shift source test times
trap true type ulimit umask unalias unset wait
tc@E310:~$
Thanks for showing me a new command to look into.
-
Hi Rich. Shell scripts cannot catch signals while a sleep command is running in the foreground. For example, if a shell script is executing this command:
sleep 60
and I send the script SIGUSR1 (let's pretend SIGUSR1 causes the script to do something special), the script will not respond to the signal until the 60 seconds of sleep are over.
On the other hand, this useful construct:
sleep 60 & wait $!
has the same effect of causing the script to pause for 60 seconds, with the big difference that the script can respond to signals during those 60 seconds.
-
Looks like the second process might not start if the first one doesnt exit properly.Try launching them in the background with & but add a small delay between them
sh
/usr/local/sbin/lighttpd -f /usr/local/etc/lighttpd.conf &
sleep 2
/usr/local/sbin/bftpd -d &Sometimes, missing full paths or nohup can also be the issue.:) (https://narysujemy.pl)
-
Shell scripts cannot catch signals while a sleep command is running in the foreground. For example, if a shell script is executing this command:
Code: [Select]
sleep 60
and I send the script SIGUSR1 (let's pretend SIGUSR1 causes the script to do something special), the script will not respond to the signal until the 60 seconds of sleep are over.
In this case you probably want to send SIGUSR1 to the whole group
There's the difference:
% cat tst.sh
:
trap 'echo Caugth' USR1
sleep 10000000
% sh ./tst.sh &
[1] 7708
% kill -USR1 7708
<nothing happened>
% kill -USR1 -7708
User defined signal 1
Caught
[1] + exit 138 sh ./tst.sh
-
Looks like the second process might not start if the first one doesnt exit properly.Try launching them in the background with & but add a small delay between them
sh
/usr/local/sbin/lighttpd -f /usr/local/etc/lighttpd.conf &
sleep 2
/usr/local/sbin/bftpd -d &Sometimes, missing full paths or nohup can also be the issue.:) (https://narysujemy.pl)
Are they in conflict to listen on same port? Also the OP never followed up, I guess one of our responses helped already.