The commands that the module runs are
/etc/init.d/dahdi stop
/etc/init.d/dahdi status
/etc/init.d/dahdi start
The output of status is an exit code retrieved from running echo $? after the command is executed.
When exit code is === 3 then start is run. if exit code is === 0 then dahdi is already running.
[root@freepbxdev1 zulu]# /etc/init.d/dahdi status
[root@freepbxdev1 zulu]# echo $?
0
[root@freepbxdev1 zulu]# /etc/init.d/dahdi stop
Unloading DAHDI hardware modules: done
[root@freepbxdev1 zulu]# /etc/init.d/dahdi status
[root@freepbxdev1 zulu]# echo $?
3
[root@freepbxdev1 zulu]# /etc/init.d/dahdi start
Loading DAHDI hardware modules:
wct4xxp: [ OK ]
wcte43x: [ OK ]
wcte12xp: [ OK ]
wcte13xp: [ OK ]
wct1xxp: [ OK ]
wcte11xp: [ OK ]
r1t1: [ OK ]
rxt1: [ OK ]
wctdm24xxp: [ OK ]
wcaxx: [ OK ]
wcfxo: [ OK ]
wctdm: [ OK ]
rcbfx: [ OK ]
wcb4xxp: [ OK ]
wctc4xxp: [ OK ]
xpp_usb: [ OK ]
Running dahdi_cfg: [ OK ]
[root@freepbxdev1 zulu]# echo $?
0
Status codes of 0 or 3 are determined by the following code in /etc/init.d/dahdi
if [ -d /proc/dahdi ]; then
/usr/sbin/lsdahdi
RETVAL=0
else
RETVAL=3
fi
This part of the code checks if the folder /proc/dahdi exists. If it does then it executes /usr/sbin/lsdahdi