Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[OT] Cron - Bash Script Problem (-> gelöst)
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) Diskussionsforum
View previous topic :: View next topic  
Author Message
stream
Guru
Guru


Joined: 04 Jan 2003
Posts: 401

PostPosted: Fri Dec 05, 2003 2:44 pm    Post subject: [OT] Cron - Bash Script Problem (-> gelöst) Reply with quote

Hallo,

ich habe mir folgendes Bash Script geschrieben:
Quote:

#! /bin/sh

set -x
echo $PATH


Log=/var/log/xdsl.log


IP=`ifconfig ppp0 | grep addr | cut -f3 -d: | tr " " : | cut -f1 -d:`
if ping -c 1 $IP
then
echo `date` ping erfolgreich! >> $Log
else
echo `date` ping funkt nicht! >> $Log
killall pptp
sleep 20
pptp isp

fi

Wenn ich es in der Console ausführe läuft alles ohne Probleme.

Um das Script automatisch alle 5 Minuten zu starten habe ich folgenden Eintrag in die /etc/crontab eingetrage:

*/5 * * * * root sh /.../..sh

Das Script wird dann alle 5 Minuten gestartet. Allerdings wird immer ping funkt nicht ins log geschrieben und die Verbindung wird nicht mehr aufgebaut.

Weis jemand vielleicht woran das liegen könnte?


Last edited by stream on Fri Dec 05, 2003 3:11 pm; edited 1 time in total
Back to top
View user's profile Send private message
tacki
Guru
Guru


Joined: 29 Jun 2002
Posts: 418
Location: Germany

PostPosted: Fri Dec 05, 2003 2:54 pm    Post subject: Reply with quote

benütz komplette pfade... also z.b. /sbin/ifconfig statt nur ifconfig. wo die programme liegen kannst du per whereis herausfinden
Back to top
View user's profile Send private message
stream
Guru
Guru


Joined: 04 Jan 2003
Posts: 401

PostPosted: Fri Dec 05, 2003 3:10 pm    Post subject: Reply with quote

Ich hab jetzt die kompletten Pfade eingebaut - und alles funktioniert


Danke :wink:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) Diskussionsforum 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