Admins eHow SysAdmin Tips & Tricks

February 27, 2010

How to make your dreambox an automatic super downloader

Filed under: DreamBox — admin @ 9:22 pm

I am creating this post mostly for my own reference in future , the scenario is that my ISP gives me a free PPPOE username and password with unlimited traffic to download between 3am-7am and I didn’t want to keep my desktop PC up and running on midnights , so I thought I can make my dreambox which is always on an automatic midnight super downloader and after 24 hours of work , I accomplished it.
1.Create a file named “dl” containing the commands to download files in /media/sda (where flash disk is mounted) , format of file is :

wget -q -c "ftp://user:pass@ftphost/filename1" &
wget -q -c "ftp://user:pass@ftphost/filename2" &

2.make it executable :

chmod +x /media/sda/dl

3.edit /etc/ppp/ip-up and add the following to the end of file :

cd /media/sda
echo "`date` : PPPD IP-UP" >> /media/sda/dl.log

4.edit /etc/ppp/ip-down and add the following to the end of file :

killall wget
echo "`date` : PPPD IP-DOWN" >> /media/sda/dl.log

ip-up is automatically called when PPP connection is established. it starts all downloads automatically.
ip-down is automatically called when PPP connection is disconnected. it stops all downloads automatically.
5.Create monitor-pppd in /media/sda and put the following inside it ( also make it executable ) :

if [ ! -e "/proc/sys/net/ipv4/conf/ppp0" ];
        echo "`date` : restarting pppd" >> /media/sda/dl.log
        killall pppd
        pppd plugin eth0 user USERNAME password PASSWORD noauth defaultroute replacedefaultroute

6.create a cron job by creating a file named root inside /etc/cron/crontabs folder and paste the following inside it :

* 3,4,5,6 * * * /media/sda/monitor-pppd

and restart the cron daemon by calling :

/usr/script/ restart

the cron daemon will establish the PPPOE connection automatically and monitor-ppd will monitor it.
don’t forget the time should be synchronized and timezone should be set correctly.

Powered by WordPress