I want to execute a script in init process, and I want it auto restart whenever it is terminated.
I put this line in /etc/inittab
and the test.sh contains this line (I simplified the script for clarity):
[ -e /dev/ttyUSB0 ] && echo 'hello, USB0' > /root/dump
Then I reboot my system to test the result, unfortunately, I never get a dump file in /root/ containing the line 'hello, USB0', which indicates that the /dev/ttyUSB0 does not exist.
After I log in and type
ls /dev/tty* I can see that the /dev/ttyUSB0 is right there.
I use openwrt 3.3.8, and I have installed kmod-usb-serial-pl2303 module so openwrt can recognize my usb device.
What's the problem? Is the usb serial module not loaded when init process running? Sorry for my poorly English, any help will be appreciated.