it does not working at all via script even if i try to start one program. But when try on bash is working fine. And no the programs are not interfering each other.
You btw do not need to use sudo inside this script, it runs as root user anyway during boot. If the second program does not start, then the first does not stop. Indeed running those from console should help to investigate the issue, also you could run the whole script:
When using sleep 20 command inside script and running as sudo I have this on logs:
custom.sh[383]: sleep: invalid option -- '4'
custom.sh[383]: Try 'sleep --help' for more information.
When I run without sleep 2 programs only one is starting. The second one is like not have put on the script.
Both programs must be stay open to be fully operational.
For systemd I have tried but it is a bit mess with runlevels, meaning that sometimes the services might start earlier or later and that create a huge mess.
Looks like a syntax error.
Can you post your script?
And which editor did you use? Maybe there are some invisible characers in it, which break the script.
You could try cat -v script.sh to show weird characters.
Yes with this way working thank you. With one program the sleep command working, it is a bit strange to be on different line from the main program command but it works.
Trying with second program to start but still no success. Both program must be staying running to work. I am thinking if there is a way to start automatic 2 scripts to boot is there a way to make this happen?
My concern is the ouput to the terminal, but I don’t know how this behaves when the process is started inside a script.
The last link also provides a solution for this:
Let the output post to /dev/null instead to STDOUT or STDERR (standard output and standard error output, which should be terminal, if you run headless?!)
the solution would be:
sudo nice -n 19 Program 1 &>/dev/null &
What I am seeing inside the script when running both programs are working normal i do not print information on terminal or anything like this. I am seeing also that the script closing successfully after starting the programs. The &>/dev/null & I think is for programs that print on terminal and to avoid the conflict on bash it can be useful.
As for systemd to be working with my apps I have to configure every service to have the correct order so to be ok. The start up script is helping me because it start on the last or almost on the last runlevel and avoid all this. Of course if something goes wrong I have to do with the “hard way”. For now the information was very helpful.
Just as a side note, I’d remove the & from the second program call. Otherwise the parent script exits before any program finished, which can cause issues, basically orphaned child processes.