( freyr | 2010. 05. 31., h – 01:39 )

Ezt sikerült összehozni némi gondolkodás és keresgélés után:

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions
echo -e "\033[1;37m"
KP="n"
read -s -n1 -p "Do I skip the start of adsl and openntpd daemons? (y/n) " -t 3 KP
echo -e "\033[m"
if [ "$KP" != "y" ];
then

case "$1" in start) stat_busy "Starting ADSL Connection"
/usr/sbin/pppoe-start &>/dev/null
if [ $? -gt 0 ]; then stat_fail

else

add_daemon adsl
stat_done

fi
;;

stop)

stat_busy "Stopping ADSL Connection"
/usr/sbin/pppoe-stop &>/dev/null
if [ $? -gt 0 ]; then stat_fail

else

rm_daemon adsl
stat_done

fi
;;

restart)

$0 stop
sleep 1
$0 start
;;

*)

echo "usage: $0 {start|stop|restart}"

esac

/etc/rc.d/openntpd start

else

echo Skipped...

fi
exit 0

Ezzel így megoldottam azt is, hogy az openntpd csak akkor induljon el, ha van adsl kapcsolat, illetve legalábbis ha kéne lennie.
Ezt az egészet pedig beraktam egy /etc/rc.d/boottimeadsl fájlba, majd beírtam a daemonok közé a /etc/rc.conf fájlban a boottimeadsl-t az adsl és az openntpd helyett. Eddig nem is gondoltam, hogy ez lehetséges.

sunmao: a függvényes megoldás jól hangzik, erről jutott eszembe, hogy még ez se kell, hanem meghívhatom az adsl scriptet is ahelyett, hogy beírnám, épp úgy, mint az openntpd-t, úgyhogy át is írtam olyanra:

#!/bin/bash

echo -e "\033[1;37m"
KP="n"
read -s -n1 -p "Do I skip the start of adsl and openntpd daemons? (y/n) " -t 3 KP
echo -e "\033[m"
if [ "$KP" != "y" ];
then

/etc/rc.d/adsl start
/etc/rc.d/openntpd start

else

echo Skipped...

fi
exit 0