Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

::respawn:/root/test.sh

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.

share|improve this question
1  
What kind of system are you on? /etc/inittab was the original configuration file at the time of the true, original Sys V init daemon. Nowadays, the init daemon uses the .conf files in /etc/init. –  MariusMatutiae Dec 17 '13 at 11:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.