Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Problem mit rc-script (syntax errors)
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
stream
Guru
Guru


Joined: 04 Jan 2003
Posts: 401

PostPosted: Sat Feb 28, 2004 1:38 pm    Post subject: Problem mit rc-script (syntax errors) Reply with quote

Beim Start:
Code:

root # /etc/init.d/fw start
 * ERROR:  "/etc/init.d/fw" has syntax errors in it; not executing...


Das Script befindet sich hier

Ich kann im Script keinen Fehler finden. An die Hinweise in der Doc von gentoo.org habe ich mich gehalten.
Back to top
View user's profile Send private message
Sas
Veteran
Veteran


Joined: 05 Jul 2003
Posts: 1229
Location: Germany

PostPosted: Sat Feb 28, 2004 5:17 pm    Post subject: Reply with quote

bei dir fehlen die zweige "restart" und "status" ich meine die müssen rein.
dann gibts noch "reload" und "force-reload", aber die sind optional

edit: hmm ok, ich lese gerade in der gentoo doku, dass alles ausser "start" optional ist. dann fällt mir auch nix ein, sry.
_________________
42
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Sun Feb 29, 2004 12:17 am    Post subject: Reply with quote

Code:
WAN_IP="(ifconfig eth0 | head -n 2 | tail -n1 | cut -d: -f2 | cut -d" " -f1)"


sollte heissen

Code:
WAN_IP="(ifconfig eth0 | head -n 2 | tail -n1 | cut -d: -f2 | cut -d ' ' -f1)"
# oder
WAN_IP="(ifconfig eth0 | head -n 2 | tail -n1 | cut -d: -f2 | cut -d\" \" -f1)"


ist 2x der Fehler. Probiers mal und poste Ergebnis.
Back to top
View user's profile Send private message
stream
Guru
Guru


Joined: 04 Jan 2003
Posts: 401

PostPosted: Sun Feb 29, 2004 6:11 am    Post subject: Reply with quote

hab beides ausprobiert - dadurch ändert sich aber nichts
Back to top
View user's profile Send private message
Mr.Big
Guru
Guru


Joined: 10 Apr 2002
Posts: 424
Location: Königswartha / Germany

PostPosted: Sun Feb 29, 2004 8:48 am    Post subject: Reply with quote

mach mal aus
Code:
ifconfig
Code:
/sbin/ifconfig
!
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Sun Feb 29, 2004 10:27 am    Post subject: Reply with quote

@ Mr.Big

Ein falscher Pfad dürfte keine Syntax-Error geben.

@stream

Du kannst es auch debuggen indem Du in der ersten Zeile das #!/sbin/runscript durch ein #!/bin/bash -x ersetzt und vor die einzelnen Funktionen ein "function" schreibst und diese einzeln am Ende aufrufst...

Code:

#!/bin/bash -x
...
function start()
...
function stop()
....
# ebegin auskommentieren
# eend auch

start


Das zeigt alle Befehle vor dem Ausführen an. Sollte helfen den Fehler zu finden.
Back to top
View user's profile Send private message
stream
Guru
Guru


Joined: 04 Jan 2003
Posts: 401

PostPosted: Sun Feb 29, 2004 11:06 am    Post subject: Reply with quote

Danke für den Hinweis mit dem Debuggen :wink:
Code:

root # sh /etc/init.d/fw start
/etc/init.d/fw: line 31: syntax error near unexpected token `/bin/echo'
/etc/init.d/fw: line 31: `/bin/echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts'





Ich hab das jetzt mit:
Code:

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
/bin/echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
/bin/echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts


im Script versucht. Ohne Erfolg

Direkt über die Console funktioniert es ohne Probleme.
Back to top
View user's profile Send private message
Mr.Big
Guru
Guru


Joined: 10 Apr 2002
Posts: 424
Location: Königswartha / Germany

PostPosted: Sun Feb 29, 2004 11:26 am    Post subject: Reply with quote

Ja, ja die kleinen Fehler sind die schönsten!

Mach mal aus
Code:
eend $? "Failed to load iptables" }
Code:
eend $? "Failed to load iptables"
}

:wink:
Back to top
View user's profile Send private message
stream
Guru
Guru


Joined: 04 Jan 2003
Posts: 401

PostPosted: Sun Feb 29, 2004 11:31 am    Post subject: Reply with quote

An dem liegts leider nicht :cry:
Back to top
View user's profile Send private message
Mr.Big
Guru
Guru


Joined: 10 Apr 2002
Posts: 424
Location: Königswartha / Germany

PostPosted: Sun Feb 29, 2004 11:43 am    Post subject: Reply with quote

Nach der Änderung ist bei mir der Syntaxfehler weg und das Script wird gestartet! Allerdings mit Fehler (den können wir ja mal ignorieren):
Code:
laeppi init.d # /etc/init.d/firewall-muster start
/sbin/runscript.sh: line 8:  -f1): command not found
/sbin/runscript.sh: line 10:  -f1): command not found
 * WARNING:  "firewall-muster" has already been started.


Ohne Änderung sah es so aus:
Code:
laeppi init.d # /etc/init.d/firewall-muster start
 * ERROR:  "/etc/init.d/firewall-muster" has syntax errors in it; not executing...


Da hast Du Dir warscheinlich einen neuen Fehler durchs probieren reingebaut !?
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3943
Location: Hamburg

PostPosted: Sun Feb 29, 2004 11:50 am    Post subject: Reply with quote

Neben der fehlerhaften Zeile
Code:

eend $? "Failed to load iptables" }

(die geschweifte Klammer sollte als erstes Zeichen auf einer neuenZeile stehen, da diese ansonsten als Argument von eend ausgewertet wird)
solltes Da anstelle
Code:

ifconfig eth0 | ...

besser ein
Code:

ifconfig eth0 2>/tmp/err.txt | ...

verwenden, damit die von ifconfig nach stderrr ausgegebenen Fehlermeldungen bzw. Warnungen nicht mit geparsed werden.
Back to top
View user's profile Send private message
Mr.Big
Guru
Guru


Joined: 10 Apr 2002
Posts: 424
Location: Königswartha / Germany

PostPosted: Sun Feb 29, 2004 11:53 am    Post subject: Reply with quote

Hier nochmal zum nachdenken:

Geht nicht:
Code:
    #!/sbin/runscript

start() {
    ebegin "Loading iptables script"
    eend $? "Failed to load iptables" }


Geht:
Code:
#!/sbin/runscript

start() {
    ebegin "Loading iptables script"
    eend $? "Failed to load iptables"
}
Back to top
View user's profile Send private message
stream
Guru
Guru


Joined: 04 Jan 2003
Posts: 401

PostPosted: Sun Feb 29, 2004 2:45 pm    Post subject: Reply with quote

Ok, danke Mr.Big - jetzt läufts
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum