WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: lighttpd and bftpd won't bother running at startup  (Read 115 times)

Offline jrm7262

  • Newbie
  • *
  • Posts: 26
lighttpd and bftpd won't bother running at startup
« 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 ❤️🖖

Offline ovacikar

  • Jr. Member
  • **
  • Posts: 72
Re: lighttpd and bftpd won't bother running at startup
« Reply #1 on: February 05, 2025, 10:21:17 AM »
bootlocal.sh runs commands as root

did you try forcing it to run as tc user?

Code: [Select]
sudo -u tc mycommand
« Last Edit: February 05, 2025, 10:27:45 AM by ovacikar »

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1555
Re: lighttpd and bftpd won't bother running at startup
« Reply #2 on: February 05, 2025, 10:25:28 AM »
Strange problems like this are sometimes due to a race condition. Does adding sleep 1 to bootlocal.sh (between lighttpd and bftpd) help?

Offline jrm7262

  • Newbie
  • *
  • Posts: 26
Re: lighttpd and bftpd won't bother running at startup
« Reply #3 on: February 05, 2025, 12:56:31 PM »
Thank you for the replies.

I will try sleep (and wait).

How do I force bootlocal to run a command as tcuser?

J❤️🖖

Offline ovacikar

  • Jr. Member
  • **
  • Posts: 72
Re: lighttpd and bftpd won't bother running at startup
« Reply #4 on: February 05, 2025, 01:03:24 PM »
by prepending sudo -u tc ... to the command

Offline jrm7262

  • Newbie
  • *
  • Posts: 26
Re: lighttpd and bftpd won't bother running at startup
« Reply #5 on: February 05, 2025, 01:11:25 PM »
🙂👍

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11807
Re: lighttpd and bftpd won't bother running at startup
« Reply #6 on: February 05, 2025, 03:15:43 PM »
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:
Code: [Select]
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.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1555
Re: lighttpd and bftpd won't bother running at startup
« Reply #7 on: February 05, 2025, 03:36:41 PM »
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:
Code: [Select]
sleep 60and 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:
Code: [Select]
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.
« Last Edit: February 05, 2025, 03:38:19 PM by GNUser »