[opensuse] Boot Script
Dear All, I have script was run on Redhat 9 (I put in /etc/rc.d/rc.local) ----snip--- EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INT_IP="/sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INTRANET="192.168.1.0/24" iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j DROP ---snip--- But it is unable to run on SuSE 11.1 (I put in /etc/rc.d/boot.local) Seems SuSE did not recognize the command EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1" Thanks a lot for your helps and advises. Best regards, Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Wong, On Thu, 01 Oct 2009, 09:03:57 +0200, Wong wrote:
Dear All,
I have script was run on Redhat 9 (I put in /etc/rc.d/rc.local)
----snip---
EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INT_IP="/sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INTRANET="192.168.1.0/24" iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j DROP
---snip---
But it is unable to run on SuSE 11.1 (I put in /etc/rc.d/boot.local)
Seems SuSE did not recognize the command EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1"
Thanks a lot for your helps and advises.
I'm sure your script didn't do what you expected it to do on Red Hat either. The line EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1" just assigns the text literally to the variable $EXT_IP. If you actually want to get the output of the command, you'd have to put `...` around the command as in: EXT_IP="`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1`" The same is true for the INT_IP line.
Best regards,
Wong
HTH, cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Manfred,
I have script was run on Redhat 9 (I put in /etc/rc.d/rc.local)
----snip---
EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INT_IP="/sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INTRANET="192.168.1.0/24" iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j DROP
---snip---
But it is unable to run on SuSE 11.1 (I put in /etc/rc.d/boot.local)
Seems SuSE did not recognize the command EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1"
Thanks a lot for your helps and advises.
I'm sure your script didn't do what you expected it to do on Red Hat either. The line
EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1"
Before those lines, I had EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` , but not work
just assigns the text literally to the variable $EXT_IP. If you actually want to get the output of the command, you'd have to put `...` around the command as in:
EXT_IP="`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1`"
The same is true for the INT_IP line.
I just tried the line above but also could not work as expected. Please advise. TIA Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Wong, On Thu, 01 Oct 2009, 11:55:41 +0200, Wong wrote:
Hi Manfred,
I have script was run on Redhat 9 (I put in /etc/rc.d/rc.local)
----snip---
EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INT_IP="/sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INTRANET="192.168.1.0/24" iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j DROP
---snip---
But it is unable to run on SuSE 11.1 (I put in /etc/rc.d/boot.local)
Seems SuSE did not recognize the command EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1"
Thanks a lot for your helps and advises.
I'm sure your script didn't do what you expected it to do on Red Hat either. The line
EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1"
Before those lines, I had EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` , but not work
it's perhaps that current versions of ifconfig now also print out the IPv6 address, which results in a trailing newline in your command. If your actually only interested in the IPv4 address, you should use the following command: EXT_IP="`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`" If you want the IPv6 address, use this: EXT_IP="`/sbin/ifconfig eth0 | sed -n -e 's,.*inet6 addr:[ ]*\([^ ]*\) .*$,\1,p'`"
just assigns the text literally to the variable $EXT_IP. If you actually want to get the output of the command, you'd have to put `...` around the command as in:
EXT_IP="`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1`"
The same is true for the INT_IP line.
I just tried the line above but also could not work as expected.
If the above still doesn't work for you, you should describe what you expect.
Please advise. TIA
Wong
Cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Manfred,
I have script was run on Redhat 9 (I put in /etc/rc.d/rc.local)
----snip---
EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INT_IP="/sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1" INTRANET="192.168.1.0/24" iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j DROP
---snip---
But it is unable to run on SuSE 11.1 (I put in /etc/rc.d/boot.local)
Seems SuSE did not recognize the command EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1"
Thanks a lot for your helps and advises.
I'm sure your script didn't do what you expected it to do on Red Hat either. The line
EXT_IP="/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1"
Before those lines, I had EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` , but not work
it's perhaps that current versions of ifconfig now also print out the IPv6 address, which results in a trailing newline in your command. If your actually only interested in the IPv4 address, you should use the following command:
EXT_IP="`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`"
If you want the IPv6 address, use this:
EXT_IP="`/sbin/ifconfig eth0 | sed -n -e 's,.*inet6 addr:[ ]*\([^ ]*\) .*$,\1,p'`"
just assigns the text literally to the variable $EXT_IP. If you actually want to get the output of the command, you'd have to put `...` around the command as in:
EXT_IP="`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1`"
The same is true for the INT_IP line.
I just tried the line above but also could not work as expected.
If the above still doesn't work for you, you should describe what you expect.
I have want the script will automatically read the IP of each NIC. Then the value (IP addr) will be given to other lines of scripts. Here the result of my simulation: Server:~ # /sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1 192.168.1.1 (By using sample you gave, there was no IP addr output.) But I don't know why the line EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` was not functioning in SuSE. Does the line #! /bin/sh cause the issue? In RH9 it was #! /bin/bash. Thanks Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Wong, On Thu, 01 Oct 2009, 12:50:11 +0200, Wong wrote:
[...]
it's perhaps that current versions of ifconfig now also print out the IPv6 address, which results in a trailing newline in your command. If your actually only interested in the IPv4 address, you should use the following command:
EXT_IP="`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`"
If you want the IPv6 address, use this:
EXT_IP="`/sbin/ifconfig eth0 | sed -n -e 's,.*inet6 addr:[ ]*\([^ ]*\) .*$,\1,p'`"
just assigns the text literally to the variable $EXT_IP. If you actually want to get the output of the command, you'd have to put `...` around the command as in:
EXT_IP="`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1`"
The same is true for the INT_IP line.
I just tried the line above but also could not work as expected.
If the above still doesn't work for you, you should describe what you expect.
I have want the script will automatically read the IP of each NIC. Then the value (IP addr) will be given to other lines of scripts.
Here the result of my simulation:
Server:~ # /sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1 192.168.1.1
(By using sample you gave, there was no IP addr output.)
hmm, works perfectly well here. Do you have any LANG or LC_* variables set to some other value than C, POSIX, or en_US? If yes, you should prefix the /sbin/ifconfig with "env LANG=POSIX LC_ALL=POSIX".
But I don't know why the line EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` was not functioning in SuSE.
can you add "set -x" to your script and post the output from running the script?
Does the line #! /bin/sh cause the issue? In RH9 it was #! /bin/bash.
no, that would be highly unlikely, at least in a "normal" setup ;-) Please show the output from the following commands: # ls -als /bin/sh # rpm -qf /bin/sh
Thanks
Wong
Cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, 01 Oct 2009, 12:50:11 +0200, Wong wrote:
[...]
it's perhaps that current versions of ifconfig now also print out the IPv6 address, which results in a trailing newline in your command. If your actually only interested in the IPv4 address, you should use the following command:
EXT_IP="`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`"
If you want the IPv6 address, use this:
EXT_IP="`/sbin/ifconfig eth0 | sed -n -e 's,.*inet6 addr:[ ]*\([^ ]*\) .*$,\1,p'`"
just assigns the text literally to the variable $EXT_IP. If you actually want to get the output of the command, you'd have to put `...` around the command as in:
EXT_IP="`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1`"
The same is true for the INT_IP line.
I just tried the line above but also could not work as expected.
If the above still doesn't work for you, you should describe what you expect.
I have want the script will automatically read the IP of each NIC. Then the value (IP addr) will be given to other lines of scripts.
Here the result of my simulation:
Server:~ # /sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1 192.168.1.1
(By using sample you gave, there was no IP addr output.)
hmm, works perfectly well here. Do you have any LANG or LC_* variables set to some other value than C, POSIX, or en_US? If yes, you should prefix the /sbin/ifconfig with "env LANG=POSIX LC_ALL=POSIX".
My apologize to misinform, your sample of script is able to run. I missed the ' sign after .*$,\1,p. Below the result: Server:~ # /sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p' 192.168.1.1 But it result same issue if run in boot.local
But I don't know why the line EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` was not functioning in SuSE.
can you add "set -x" to your script and post the output from running the script?
Where can I put the command?
Does the line #! /bin/sh cause the issue? In RH9 it was #! /bin/bash.
no, that would be highly unlikely, at least in a "normal" setup ;-) Please show the output from the following commands:
# ls -als /bin/sh # rpm -qf /bin/sh
Here it is: Server:~ # ls -als /bin/sh 0 lrwxrwxrwx 1 root root 4 Sep 4 14:11 /bin/sh -> bash Server:~ # rpm -qf /bin/sh bash-3.2-141.10 Here is my boot.local scripts #! /bin/sh # iptables -F iptables --table nat --flush iptables --delete-chain iptables --table nat --delete-chain #EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` EXT_IP=`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'` #INT_IP=`/sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1` INT_IP=`/sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'` INTRANET="192.168.1.0/24" iptables -A INPUT -s 0/0 -d $EXT_IP -p tcp --dport 25 -j ACCEPT iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j LOG iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j DROP All scripts that use $EXT_IP and $INT_IP are unable run. Thanks a lot, Manfred. Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Wong, On Thu, 01 Oct 2009, 13:41:29 +0200, Wong wrote:
[...]
hmm, works perfectly well here. Do you have any LANG or LC_* variables set to some other value than C, POSIX, or en_US? If yes, you should prefix the /sbin/ifconfig with "env LANG=POSIX LC_ALL=POSIX".
My apologize to misinform, your sample of script is able to run. I missed the ' sign after .*$,\1,p. Below the result:
Server:~ # /sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p' 192.168.1.1
But it result same issue if run in boot.local
Which issue?
[...]
can you add "set -x" to your script and post the output from running the script?
Where can I put the command?
Right after the '#! /bin/sh' line.
Does the line #! /bin/sh cause the issue? In RH9 it was #! /bin/bash.
no, that would be highly unlikely, at least in a "normal" setup ;-) Please show the output from the following commands:
# ls -als /bin/sh # rpm -qf /bin/sh
Here it is:
Server:~ # ls -als /bin/sh 0 lrwxrwxrwx 1 root root 4 Sep 4 14:11 /bin/sh -> bash
Server:~ # rpm -qf /bin/sh bash-3.2-141.10
This looks OK.
Here is my boot.local scripts
#! /bin/sh #
You could add here: set -x export LANG=POSIX export LC_ALL=POSIX
iptables -F iptables --table nat --flush iptables --delete-chain iptables --table nat --delete-chain
#EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` EXT_IP=`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
Make sure, this is *one* line! So this should be: EXT_IP=`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
#INT_IP=`/sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1` INT_IP=`/sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
Same here! INT_IP=`/sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
INTRANET="192.168.1.0/24"
iptables -A INPUT -s 0/0 -d $EXT_IP -p tcp --dport 25 -j ACCEPT iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j LOG iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j DROP
All scripts that use $EXT_IP and $INT_IP are unable run.
Thanks a lot, Manfred.
You're welcome, but, please don't copy me on every e-mail as I'm subscribed to this list ;-)
Wong
Cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, 01 Oct 2009, 13:41:29 +0200, Wong wrote:
[...]
hmm, works perfectly well here. Do you have any LANG or LC_* variables set to some other value than C, POSIX, or en_US? If yes, you should prefix the /sbin/ifconfig with "env LANG=POSIX LC_ALL=POSIX".
My apologize to misinform, your sample of script is able to run. I missed the ' sign after .*$,\1,p. Below the result:
Server:~ # /sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p' 192.168.1.1
But it result same issue if run in boot.local
Which issue?
[...]
can you add "set -x" to your script and post the output from running the script?
Where can I put the command?
Right after the '#! /bin/sh' line.
Does the line #! /bin/sh cause the issue? In RH9 it was #! /bin/bash.
no, that would be highly unlikely, at least in a "normal" setup ;-) Please show the output from the following commands:
# ls -als /bin/sh # rpm -qf /bin/sh
Here it is:
Server:~ # ls -als /bin/sh 0 lrwxrwxrwx 1 root root 4 Sep 4 14:11 /bin/sh -> bash
Server:~ # rpm -qf /bin/sh bash-3.2-141.10
This looks OK.
Here is my boot.local scripts
#! /bin/sh #
You could add here:
set -x export LANG=POSIX export LC_ALL=POSIX
iptables -F iptables --table nat --flush iptables --delete-chain iptables --table nat --delete-chain
#EXT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1` EXT_IP=`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
Make sure, this is *one* line! So this should be:
EXT_IP=`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
#INT_IP=`/sbin/ifconfig eth1 | grep inet | cut -d : -f 2 | cut -d \ -f 1` INT_IP=`/sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
Same here!
INT_IP=`/sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
INTRANET="192.168.1.0/24"
iptables -A INPUT -s 0/0 -d $EXT_IP -p tcp --dport 25 -j ACCEPT iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j LOG iptables -A FORWARD -s $INTRANET -d ! $INT_IP -p tcp --dport 25 -j DROP
All scripts that use $EXT_IP and $INT_IP are unable run.
Thanks a lot, Manfred.
You're welcome, but, please don't copy me on every e-mail as I'm subscribed to this list ;-)
Manfred, I check my kernel setting, and found that option POSIX Message Queues set to disable. Now, I am recompiling kernel with POSIX Message Queues set to enable. Need sometime to complete and see the result. Thanks, Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Wong, On Thu, 01 Oct 2009, 15:51:09 +0200, Wong wrote:
On Thu, 01 Oct 2009, 13:41:29 +0200, Wong wrote:
[...] Here is my boot.local scripts
#! /bin/sh #
You could add here:
set -x export LANG=POSIX export LC_ALL=POSIX
Manfred,
I check my kernel setting, and found that option POSIX Message Queues set to disable. Now, I am recompiling kernel with POSIX Message Queues set to enable.
Need sometime to complete and see the result.
but the POSIX Message Queues setting has nothing to do with the LANG/LC_ALL setting above. BTW, my kernel has CONFIG_POSIX_MQUEUE set to 'y', so which distribution version/kernel version are you using?
Thanks,
Wong
Cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, 01 Oct 2009, 13:41:29 +0200, Wong wrote:
[...] Here is my boot.local scripts
#! /bin/sh #
You could add here:
set -x export LANG=POSIX export LC_ALL=POSIX
Manfred,
I check my kernel setting, and found that option POSIX Message Queues set to disable. Now, I am recompiling kernel with POSIX Message Queues set to enable.
Need sometime to complete and see the result.
but the POSIX Message Queues setting has nothing to do with the LANG/LC_ALL setting above. BTW, my kernel has CONFIG_POSIX_MQUEUE set to 'y', so which distribution version/kernel version are you using?
Yes Manfred, you are correct. After re-compile kernel I got same result. All scripts that use $EXT_IP and $INT_IP cannot run (start to confuse). I also already put the lines: #! /bin/sh set -x export LANG=POSIX export LC_ALL=POSIX before all of scripts, but no success. I am using 2.6.31.1 with modified kernel setting (I use my own style) Do you have any ideas about LANG/LC_ALL? Thanks Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Wong, On Thu, 01 Oct 2009, 16:23:25 +0200, Wong wrote:
On Thu, 01 Oct 2009, 13:41:29 +0200, Wong wrote:
[...] Here is my boot.local scripts
#! /bin/sh #
You could add here:
set -x export LANG=POSIX export LC_ALL=POSIX
Manfred,
I check my kernel setting, and found that option POSIX Message Queues set to disable. Now, I am recompiling kernel with POSIX Message Queues set to enable.
Need sometime to complete and see the result.
but the POSIX Message Queues setting has nothing to do with the LANG/LC_ALL setting above. BTW, my kernel has CONFIG_POSIX_MQUEUE set to 'y', so which distribution version/kernel version are you using?
Yes Manfred, you are correct.
After re-compile kernel I got same result. All scripts that use $EXT_IP and $INT_IP cannot run (start to confuse).
now you start to confuse me... ;-) What happens if you call /etc/init.d/boot.local Is that script executable?
I also already put the lines:
#! /bin/sh set -x export LANG=POSIX export LC_ALL=POSIX
before all of scripts, but no success.
I am using 2.6.31.1 with modified kernel setting (I use my own style)
Do you have any ideas about LANG/LC_ALL?
This is just a way to avoid having to parse all those local languages which are printed with LANG/LC_ALL set to anything else C/POSIX/en_US, like: env LANG=de_DE LC_ALL=de_DE /sbin/ifconfig eth0 eth0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX inet Adresse:192.168.x.y Bcast:192.168.x.255 Maske:255.255.255.0 inet6 Adresse: ...
Thanks
Wong
HTH, cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi Wong,
On Thu, 01 Oct 2009, 16:23:25 +0200, Wong wrote:
On Thu, 01 Oct 2009, 13:41:29 +0200, Wong wrote:
[...] Here is my boot.local scripts
#! /bin/sh #
You could add here:
set -x export LANG=POSIX export LC_ALL=POSIX
Manfred,
I check my kernel setting, and found that option POSIX Message Queues set to disable. Now, I am recompiling kernel with POSIX Message Queues set to enable.
Need sometime to complete and see the result.
but the POSIX Message Queues setting has nothing to do with the LANG/LC_ALL setting above. BTW, my kernel has CONFIG_POSIX_MQUEUE set to 'y', so which distribution version/kernel version are you using?
Yes Manfred, you are correct.
After re-compile kernel I got same result. All scripts that use $EXT_IP and $INT_IP cannot run (start to confuse).
now you start to confuse me... ;-) What happens if you call
/etc/init.d/boot.local
Is that script executable?
I also already put the lines:
#! /bin/sh set -x export LANG=POSIX export LC_ALL=POSIX
before all of scripts, but no success.
I am using 2.6.31.1 with modified kernel setting (I use my own style)
Do you have any ideas about LANG/LC_ALL?
This is just a way to avoid having to parse all those local languages which are printed with LANG/LC_ALL set to anything else C/POSIX/en_US, like:
env LANG=de_DE LC_ALL=de_DE /sbin/ifconfig eth0 eth0 Link encap:Ethernet Hardware Adresse XX:XX:XX:XX:XX:XX inet Adresse:192.168.x.y Bcast:192.168.x.255 Maske:255.255.255.0 inet6 Adresse: ...
Manfred, I understand, I type "ifconfig eth0" and get message below: Server:/usr/src/linux-2.6.31.1 # ifconfig eth1 eth1 Link encap:Ethernet HWaddr 00:60:97:23:E2:44 inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1764 errors:0 dropped:0 overruns:0 frame:0 TX packets:1784 errors:0 dropped:0 overruns:0 carrier:0 collisions:105 txqueuelen:1000 RX bytes:220250 (215.0 Kb) TX bytes:860729 (840.5 Kb) Interrupt:20 Base address:0xd000 Then I typed: Server :/usr/src/linux-2.6.31.1 # /sbin/ifconfig eth1 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p' 192.168.1.1 The language should be OK, isn't it? Please correct me. Thanks Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thu, 01 Oct 2009, 16:42:07 +0200, Manfred Hollstein wrote:
[...] now you start to confuse me... ;-) What happens if you call
/etc/init.d/boot.local
Is that script executable?
Hmm, couldn't see the forest for the trees... When boot.local gets executed, no network is up and running ;-) You should stick your commands into a file /etc/init.d/after.local . HTH, cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday, 2009-10-01 at 17:05 +0200, Manfred Hollstein wrote:
Hmm, couldn't see the forest for the trees... When boot.local gets executed, no network is up and running ;-) You should stick your commands into a file /etc/init.d/after.local .
Correct. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkrFC4sACgkQtTMYHG2NR9UyOACgmLrFO7ipN0CN72Msl0XLQmFt Y+0AnjLdT1QSD6stvvyQLwZjT76YOHy0 =g/27 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello Manfred & Carlos
On Thu, 01 Oct 2009, 16:42:07 +0200, Manfred Hollstein wrote:
[...] now you start to confuse me... ;-) What happens if you call
/etc/init.d/boot.local
Is that script executable?
Hmm, couldn't see the forest for the trees... When boot.local gets executed, no network is up and running ;-) You should stick your commands into a file /etc/init.d/after.local .
This morning I tried to put all lines of my script into after.local, and IT RUNS so nicely ! Thousand thanks for all of you. This is my first experience to play with SuSE. I never knew there is a "helper" named after.local. Again thank you very much for your patience to assist a newbie like me. Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, 2009-10-02 at 10:57 +0800, Wong wrote:
Hello Manfred & Carlos
This morning I tried to put all lines of my script into after.local, and IT RUNS so nicely ! Thousand thanks for all of you.
Good :-)
This is my first experience to play with SuSE. I never knew there is a "helper" named after.local.
Well, not everybody knows, it is relatively new. Previously, we had to add a new service instead. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkrGbB4ACgkQtTMYHG2NR9V+2wCeMeYzPeH62vyKMS+8HUXivHEZ 3FAAn1Z/rpqt+2YLThnKlxK2hjkm0QY8 =G7C1 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Friday, 2009-10-02 at 10:57 +0800, Wong wrote:
Hello Manfred & Carlos
This morning I tried to put all lines of my script into after.local, and IT RUNS so nicely ! Thousand thanks for all of you.
Good :-)
This is my first experience to play with SuSE. I never knew there is a "helper" named after.local.
Well, not everybody knows, it is relatively new. Previously, we had to add a new service instead.
Thank you.... thank you very much. Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Sat, Oct 3, 2009 at 5:09 AM, Carlos E. R.
Well, not everybody knows, it is relatively new. Previously, we had to add a new service instead.
I didn't know it. I always add a new service in /etc/init.d to do this. Is it documented? Sound like finally we have rc.local :-) I will test this after.local Thanks Carlos for the hint! regards, -- medwinz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday, 2009-10-03 at 12:02 +0800, medwinz wrote:
On Sat, Oct 3, 2009 at 5:09 AM, Carlos E. R. <> wrote:
Well, not everybody knows, it is relatively new. Previously, we had to add a new service instead.
I didn't know it. I always add a new service in /etc/init.d to do this. Is it documented? Sound like finally we have rc.local :-) I will test this after.local
I'm unsure if I discovered it by chance, or if somebody mentioned it here. Previously, I inserted a service after "SuSEfirewall2_final", because "$ALL" didn't always work. In /etc/init.d/skeleton.compat, it says it should, but I think is is a recent addition, too; if IIRC, it was for UL only: # UnitedLinux/SUSE/Novell extensions: # $ALL indicates that a script should be inserted # at the end whereas /etc/init.d/skeleton says: # UnitedLinux extensions: # $ALL indicates that a script should be inserted # at the end I wonder which runs first, if that or after.local :-?
Thanks Carlos for the hint!
Welcome, but Manfred said it first :-) - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkrIiw0ACgkQtTMYHG2NR9X+4gCeNrBJCjDZ7ga2jvnPQrQmK3lS 9rkAoJgKndAXCZ74120QwKCqmW0xfXVG =pPqh -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi there, On Sun, 04 Oct 2009, 13:46:13 +0200, Carlos E. R. wrote:
[...] I'm unsure if I discovered it by chance, or if somebody mentioned it here.
Previously, I inserted a service after "SuSEfirewall2_final", because "$ALL" didn't always work. In /etc/init.d/skeleton.compat, it says it should, but I think is is a recent addition, too; if IIRC, it was for UL only:
# UnitedLinux/SUSE/Novell extensions: # $ALL indicates that a script should be inserted # at the end
whereas /etc/init.d/skeleton says:
# UnitedLinux extensions: # $ALL indicates that a script should be inserted # at the end
I wonder which runs first, if that or after.local :-?
According to /etc/init.d/rc, it's after.local which runs at the final end. Cheers. l8er manfred -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, On Thu, 01 Oct 2009, Manfred Hollstein wrote:
Make sure, this is *one* line! So this should be:
EXT_IP=`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
For completeness (I hope the output format is still the same), and with $() instead of ``: export LANG=C EXT_IP=$(/sbin/ip addr show eth0 | sed -n 's/^ *inet \([0-9.]\+\) .*eth0$/\1/p') INT_IP=$(/sbin/ip addr show eth1 | sed -n 's/^ *inet \([0-9.]\+\) .*eth1$/\1/p') (if you make one line, remove the '\' at the end of the first line) The '.*eth0$' at the end of the expression is because interface-aliases show up in the output. HTH, -dnh -- Warning: Pregnancy can cause birth -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hi David
Hello,
On Thu, 01 Oct 2009, Manfred Hollstein wrote:
Make sure, this is *one* line! So this should be:
EXT_IP=`/sbin/ifconfig eth0 | sed -n -e 's,.*inet addr:[ ]*\([^ ]*\) .*$,\1,p'`
For completeness (I hope the output format is still the same), and with $() instead of ``:
export LANG=C EXT_IP=$(/sbin/ip addr show eth0 | sed -n 's/^ *inet \([0-9.]\+\) .*eth0$/\1/p') INT_IP=$(/sbin/ip addr show eth1 | sed -n 's/^ *inet \([0-9.]\+\) .*eth1$/\1/p')
(if you make one line, remove the '\' at the end of the first line)
The '.*eth0$' at the end of the expression is because interface-aliases show up in the output.
Yes, the output is 100% same. Thanks Wong -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (5)
-
Carlos E. R.
-
David Haller
-
Manfred Hollstein
-
medwinz
-
Wong