|
Home > Archive > alt.os.linux > December 2002 > only half script executed??
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
only half script executed??
|
|
| Matthias Wulkow 2002-12-19, 6:25 pm |
| Hi,
I have a ip-up.local script which is moreless only half executed.
What would be a reason why it doesn't execute all? I can't find any error
log about it...
I'm using Mandrake 8.2.
The first part about the time is executed. I know, because my time-script
works. But no lines are written into $connection (/var/log/connection.log)
neither ntpd is restarted (or started)...
Permissions are set to -rwxr-xr-x , but -rwxr-x--- would be even better I
think...
I'd appreciate any help , thanks
<--------------------------->
>---------------------------<
<--------------------------->
Here is the script:
#!/bin/bash
SEARCHSTRING="ppp0"
UPTIME=`date`
dir="/tmp/uptime/"
connection="/var/log/connection.log"
if [ -d $dir ]
then
rm -rf $dir
fi
mkdir $dir
date +%S%t%M%t%H%t%d > /tmp/uptime/oldtime
MY_IP=$(/sbin/ifconfig $SEARCHSTRING | awk '/inet/ { print $2 } ' | sed -e
s/addr://)
#Datum und Uhrzeit der Einwahl in /tmp/start_time eingeben
echo "${UPTIME}: New Connection, IP: $MY_IP" >> $connection
#check ob no-ip.com überhaupt ansprechbar sind
/bin/ping -c 2 www.no-ip.com &>> $connection
if [ $? != 0 ]
then
{
echo "" >> $connection
echo "${UPTIME}: Warnung! No-ip.com scheint nicht
erreichbar zu sein..." >> $connection
}
else
{
echo "" >> $connection
echo "${UPTIME}: momentane Erreichbarkeit: 100 %" >>
$connection
}
fi
echo "" >> $connection
#IP an no-ip.com übergeben
echo "${UPTIME}: IP an no-ip.com übergeben..." >> $connection
/bin/ps -e | grep "noip" || /usr/local/bin/noip -c /etc/no-ip.conf &>
/dev/null
if [ $? != 0 ]
then
echo "${UPTIME}: IP konnte nicht übermittelt werden. Warnung!" >>
$connection
else
echo "${UPTIME}: IP erfolgreich an no-ip.com übermittelt." >>
$connection
fi
ps -C ntpd &> /dev/null
if [ $? = 0 ]
then
{
echo "RESTARTING NTPD"
echo ""
/etc/init.d/ntpd restart
echo ""
}
else
{
echo ""
echo "STARTING NTP"
/etc/init.d/ntpd start
echo ""
}
fi >> /var/log/ntp/ntp.log 2>&1
M. W.
--
Don't smoke Linux - it's no shit!
| |
| Bill Marcum 2002-12-19, 6:25 pm |
| On 19 Dec 2002 23:41:45 GMT,
Matthias Wulkow <hostkiller@gmx.net> wrote:
> Hi,
>
> I have a ip-up.local script which is moreless only half executed.
>
> What would be a reason why it doesn't execute all? I can't find any error
> log about it...
>
> I'm using Mandrake 8.2.
>
> The first part about the time is executed. I know, because my time-script
> works. But no lines are written into $connection (/var/log/connection.log)
> neither ntpd is restarted (or started)...
>
> Permissions are set to -rwxr-xr-x , but -rwxr-x--- would be even better I
> think...
>
>
> #check ob no-ip.com überhaupt ansprechbar sind
> /bin/ping -c 2 www.no-ip.com &>> $connection
>
/bin/ping -c 2 www.no-ip.com >>& $connection
> if [ $? != 0 ]
> then
> {
> echo "" >> $connection
> echo "${UPTIME}: Warnung! No-ip.com scheint nicht
> erreichbar zu sein..." >> $connection
> }
> else
> {
> echo "" >> $connection
> echo "${UPTIME}: momentane Erreichbarkeit: 100 %" >>
> $connection
> }
> fi
>
> echo "" >> $connection
>
> #IP an no-ip.com übergeben
> echo "${UPTIME}: IP an no-ip.com übergeben..." >> $connection
>
> /bin/ps -e | grep "noip" || /usr/local/bin/noip -c /etc/no-ip.conf &>
> /dev/null
>
> if [ $? != 0 ]
> then
> echo "${UPTIME}: IP konnte nicht übermittelt werden. Warnung!" >>
> $connection
> else
> echo "${UPTIME}: IP erfolgreich an no-ip.com übermittelt." >>
> $connection
> fi
>
> ps -C ntpd &> /dev/null
>&
>
> if [ $? = 0 ]
> then
> {
> echo "RESTARTING NTPD"
> echo ""
> /etc/init.d/ntpd restart
> echo ""
> }
> else
> {
> echo ""
> echo "STARTING NTP"
> /etc/init.d/ntpd start
> echo ""
> }
> fi >> /var/log/ntp/ntp.log 2>&1
>
> M. W.
>
>
| |
| Bill Marcum 2002-12-19, 6:25 pm |
| My mistake. The bash man page says >& and &> are equivalent, but I'm still
not sure about &>> .
| |
| Matthias Wulkow 2002-12-20, 1:25 pm |
| Bill Marcum <bmarcum@iglou.com> wrote in
news:3e025ce1$1_3@news.iglou.com:
> My mistake. The bash man page says >& and &> are equivalent, but I'm
> still not sure about &>> .
>
Well, ok, but if there would be a mistake like this, I would get an error,
no? It doesn't really explain why I have nothing in my logfile...
Thanks for answer
M. W.
--
Don't smoke Linux - it's no shit!
|
|
|
|
|