Re: : bad interpreter: no such file or directory error (102 Views)
Reply
Frequent Advisor
Tarek_1
Posts: 79
Registered: ‎06-02-2002
Message 1 of 7 (102 Views)

: bad interpreter: no such file or directory error

Hi..
I'm trying to put this simple script in /etc/init.d/ and link it under /etc/rc3.d/ in order to be run after each reboot.
When i try to execute it i have the error:
: bad interpreter: no such file or directory
It's very strange, because if i copy and paste all the lines of the script it works.
I attach the script
Please use plain text.
Frequent Advisor
Tarek_1
Posts: 79
Registered: ‎06-02-2002
Message 2 of 7 (102 Views)

Re: : bad interpreter: no such file or directory error

#!/bin/bash
echo "250 32000 32 128">/proc/sys/kernel/sem
echo "2147483648">/proc/sys/kernel/shmmax
Please use plain text.
Honored Contributor
Kodjo Agbenu
Posts: 540
Registered: ‎09-20-2000
Message 3 of 7 (102 Views)

Re: : bad interpreter: no such file or directory error

Your script seems OK. However, I guess the default shell is not /bin/bash but /bin/sh with symlink to /usr/sbin/sh.

Try to change the first line accordingly (either /bin/sh or /usr/bin/bash).

Another point : some distributions pre-install the "sysctl" software that can be used for what you are trying to achieve. To use this feature :

=> Check that sysctl is installed (/etc/sysctl.conf should exist)

=> Check that sysctl is invoked at system boot-up (grep -rli sysctl /etc/rc.d)

=> Edit /etc/sysctl.conf as follows :

kernel.sem = 250 32000 32 128
kernel.shmmax = 2147483648

=> To apply changes, type : sysctl -p. You can also reboot, as this will be automatically done at every reboot.


Good luck.

Kodjo
Learn and explain...
Please use plain text.
Honored Contributor
U.SivaKumar_2
Posts: 1,752
Registered: ‎03-25-2002
Message 4 of 7 (102 Views)

Re: : bad interpreter: no such file or directory error

Hi,
The problem is nowhere related to Kernel paramters mentioned. But due to the unwanted control characters present in the script. Do this to remove the control characters from your
script.
#dos2ux your_script
#chmod +x your_script

Execute the script and the error will not appear.

regards,
U.SivaKumar
Innovations are made when conventions are broken
Please use plain text.
Trusted Contributor
Paulo A G Fessel
Posts: 180
Registered: ‎08-19-2001
Message 5 of 7 (102 Views)

Re: : bad interpreter: no such file or directory error

Hi, Tarek.

To set up these kernel sysctl's you don't need to write up a script - assuming that you're running RedHat >= 6.2.

Instead, modify /etc/sysctl.conf and add the lines:

sys.kernel.sem = "250 32000 32 128"
sys.kernel.shmmax = 2147483648

After adding these lines, they will tune these parameters in each reboot - no scripts neccessary.

HTH
Paulo Fessel
L'employé propose, le boss dispose.
Please use plain text.
Trusted Contributor
Paulo A G Fessel
Posts: 180
Registered: ‎08-19-2001
Message 6 of 7 (102 Views)

Re: : bad interpreter: no such file or directory error

Please, don't forget to assign points to the answers you got - this is the only way to keep interest and participation high.
L'employé propose, le boss dispose.
Please use plain text.
Valued Contributor
bebu
Posts: 113
Registered: ‎06-14-2011
Message 7 of 7 (95 Views)

Re: : bad interpreter: no such file or directory error

Thanks Kodjo Agbenu!!! I got the same kind of error, when i changed the firs line to /bin/bash it started worked.Kudos.. :)
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation