system() question
Is there a way to launch my realtime task from another linux program using system() C call ?
I have tried it , but when system call dies my rt task dies too ... any idea ?
steph
Quoted 5 lines · Stéphane ANCELOT
Is there a way to launch my realtime task from another linux program using
system()C call ?I have tried it , but when system call dies my rt task dies too ... any idea ?
Why does the system call die ? Do you observe the same behaviour with non xenomai applications ?
Signature · 1 line
Gilles Chanteperdrix
my linux user task uses a system() call in order to call a bash script to restart the realtime task as follow :
user interface C call :system("restart_task.sh");
give back hand to user interface
....
bash script restart_task.sh :
killall -15 mytask
sleep 2
mytask &
system call dies because sh script has been launched
Quoted 9 lines · Gilles Chanteperdrix
Quoted 4 lines · Stéphane ANCELOT
Is there a way to launch my realtime task from another linux program using
system()C call ?I have tried it , but when system call dies my rt task dies too ... any idea ?
Why does the system call die ? Do you observe the same behaviour with non xenomai applications ?
Quoted 11 lines · Stéphane ANCELOT
my linux user task uses a
system()call in order to call a bash script to restart the realtime task as follow :user interface C call :
system("restart_task.sh");
give back hand to user interface
....
Quoted 7 lines
bash script
restart_task.sh:
killall -15 mytask
sleep 2
mytask &system call dies because sh script has been launched
Try calling daemon(0,0) in mytask instead of using "&" to make it run in the background.
Signature · 1 line
Gilles Chanteperdrix.
I tried it, but did not help, I manged to do the trick using start-stop-daemon
Quoted 23 lines · Gilles Chanteperdrix
Quoted 11 lines · Stéphane ANCELOT
my linux user task uses a
system()call in order to call a bash script to restart the realtime task as follow :user interface C call :
system("restart_task.sh");
give back hand to user interface
....Quoted 7 lines
bash script
restart_task.sh:
killall -15 mytask
sleep 2
mytask &system call dies because sh script has been launched
Try calling
daemon(0,0)in mytask instead of using "&" to make it run in the background.
Quoted 2 lines · Stéphane ANCELOT
I tried it, but did not help, I manged to do the trick using start-stop-daemon
If I understand correctly the problem you have, it is not related at all with Xenomai. What you want is to make your application a real daemon. The easy way to do this is to call the glibc function named "daemon" the hard way is to call fork twice, call setsid and setpgrp. start-stop-daemon will not do the trick.
Signature · 1 line
Gilles Chanteperdrix
Quoted 6 lines · Gilles Chanteperdrix
Quoted 2 lines · Stéphane ANCELOT
I tried it, but did not help, I manged to do the trick using start-stop-daemon
Quoted 6 lines
If I understand correctly the problem you have, it is not related at all with Xenomai. What you want is to make your application a real daemon. The easy way to do this is to call the glibc function named "daemon" the hard way is to call fork twice, call setsid and setpgrp. start-stop-daemon will not do the trick.
It is enough to fork only once, to call setsid in the child and call _exit in the father. That is what the daemon function does. Anyway, this is basic unix knowledge, for which you will get more acurate details at other places.
Signature · 1 line
Gilles Chanteperdrix