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 am running a shell script from a rc file in Linux. The shell script is going into a loop which runs for 8 hours. Now I want to prevent the shell script from running when Linux boots or I need to find a way to kill the shell script when it is running. I tried using killall, kill $! and Ctrl+C etc. Nothing seems to work. Can you suggest a way out. I am new to Linux.

Thanks..

share|improve this question

2 Answers 2

up vote 1 down vote accepted

As pointed out by new123456, you can just chmod -x the script to disable it (or fix it, or just delete it...).

To get into your system to do this, there are several options:

  • Try booting into single-user mode: Usually you can pass the boot option "S" on the kernel command line (edit the kernel command line in your boot manager, e.g. GRUB), then you'll boot into single-user mode. Some distros (e.g. Ubuntu) also offer a "safe boot" option that should work similarly.
  • If that fails, just boot from a Linux Live CD and mount your root partition from there, then modify it. Don't forget to unmount your root partition before you reboot!
share|improve this answer
    
what should I edit in the kernel command line to make it single user mode? –  Manoj Mar 17 '11 at 11:32
    
@Manoj Yes. You should append an 1 to the list of options. –  new123456 Mar 17 '11 at 11:39

chmod -x script will remove its executable bit. It will not be run. Ever.

share|improve this answer
    
but I am not able to type any command as the output of the script keeps coming once I boot. –  Manoj Mar 17 '11 at 11:27
    
@Manoj Use a Live CD. Boot from it, mount your root partition, and do it from there. –  new123456 Mar 17 '11 at 11:27
    
Actually I am running Linux on an embedded system and So that option is not possible. Is there no way we can stop a running shell script ? :( –  Manoj Mar 17 '11 at 11:30

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.