Hi,
Pppd man pages mention the following -
"PPPd invokes scripts at various stages in its processing which can be used to perform site-specific ancillary processing. These scripts are ususally shell scripts, but could be executable files instead. Pppd does not wait for the scripts to finish. The scripts are executed as root, so that they can do things such as update routing tables or run privileged deamons."
My questions is - if pppd does not wait for the script to finish how does it know if the script executed/terminated propely or not. More specifically, pppd runs the chat script, now how would pppd know the exit code of chat script if it does not wait for the chat script to finish?
I have a C function that starts the script as follows.
int ret = system("./ppp-on"
printf("%d", WEXITSTATUS(ret));
The ppp-on script looks as follows (only relevant portions have been posted) -
exec /usr/sbin/pppd /dev/ttyS0 115200 persist idle 3600 usepeerdns debug lock modem crtscts noauth bsdcomp 0 deflate 0 kdebug 0 asyncmap 0 connect $DIALER_SCRIPT
The DIALER_SCRIPT looks as follows -
exec /usr/sbin/chat -v
ABORT 'NOCARRIER'
ABORT 'RING'
'' AT
OK ATD$PHONE
TIMEOUT 15
CONNECT ''
The system() call returns immedialtely and prints '0' irrespective of whether the chat script establishes the connection successfully or not. Am I missing something here? I want the C function to know chat was able to establish the connection succesfully or not. How can I do this if pppd returns immedialetly without waiting for chat script to finish?
Any pointers will be highly appreciated.
Thanks.
Ruchika
Pppd man pages mention the following -
"PPPd invokes scripts at various stages in its processing which can be used to perform site-specific ancillary processing. These scripts are ususally shell scripts, but could be executable files instead. Pppd does not wait for the scripts to finish. The scripts are executed as root, so that they can do things such as update routing tables or run privileged deamons."
My questions is - if pppd does not wait for the script to finish how does it know if the script executed/terminated propely or not. More specifically, pppd runs the chat script, now how would pppd know the exit code of chat script if it does not wait for the chat script to finish?
I have a C function that starts the script as follows.
int ret = system("./ppp-on"
printf("%d", WEXITSTATUS(ret));
The ppp-on script looks as follows (only relevant portions have been posted) -
exec /usr/sbin/pppd /dev/ttyS0 115200 persist idle 3600 usepeerdns debug lock modem crtscts noauth bsdcomp 0 deflate 0 kdebug 0 asyncmap 0 connect $DIALER_SCRIPT
The DIALER_SCRIPT looks as follows -
exec /usr/sbin/chat -v
ABORT 'NOCARRIER'
ABORT 'RING'
'' AT
OK ATD$PHONE
TIMEOUT 15
CONNECT ''
The system() call returns immedialtely and prints '0' irrespective of whether the chat script establishes the connection successfully or not. Am I missing something here? I want the C function to know chat was able to establish the connection succesfully or not. How can I do this if pppd returns immedialetly without waiting for chat script to finish?
Any pointers will be highly appreciated.
Thanks.
Ruchika