linux init question

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
can I set init to a shell script? "linux init=/boot.sh"?
how about "linux init=/bin/sh /boot.sh"? how would I do that?

Thanks.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
you couldnt set it to a script, it has to be an executeable, i'm not sure how the syntax would work (quotes and stuff), but you should be able to do something like "init='/bin/sh /bin/script.sh'" but beware that by doing that, sh (bash probably) would run the script, and whenever the script exited, you would get a kernel panic and have to reboot. also by bypassing the real init, the only partition mounted would be the one that your kernel is on, and it would be in read only.
 

wildwildwes

Senior member
Jul 18, 2001
320
0
0
It's perfectly valid to use a shell script for init. I've done this.

You can mount the rest of the partitions in the script.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81


<< It's perfectly valid to use a shell script for init. I've done this.

You can mount the rest of the partitions in the script.
>>



thanks.

anyway, the script just sets up networking and runs a program. if that program dies, I want it to reboot... of course, a panic won't autoreboot... maybe i should add /sbin/reboot to my linux distro and put that as the last line of the init script.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
doesn't seem to work. i'll see if I can put togethre a small program to do it I guess.
 

wildwildwes

Senior member
Jul 18, 2001
320
0
0
The way I did it was to replace /sbin/init with the script. I got the idea from transmeta's own midori linux, so I assume it's ok with linus.
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
nope, what bingbong posted didn't work either. i didn't try replacing init.... i'll just write my program and be done ;)