Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Dialup tip for fetching large packages
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Jake96
n00b
n00b


Joined: 09 Sep 2002
Posts: 11
Location: Texas or New Zealand

PostPosted: Mon Sep 15, 2003 10:57 am    Post subject: Dialup tip for fetching large packages Reply with quote

Howdy! Just got my dose of the GWN and the gentoo-user thread about dialup tips caught my eye. I'm not subscribed to the list currently and didn't want to join just to pass this very small and ugly tip on, but posting here's much easier, so...

I'm a dialup user and sometimes really feel this, for example the recent KDE 3.1.3 update. I've only got one phone line in the apartment, and two others living here, so I can't tie the line up anytime I please. I came up with the following to let me grab packages overnight and not still be connected uselessly in the morning, eating up my monthly hour allotment.

I'm using wvdial to control my modem. I get connected, then
Code:
ps aux | grep wvdial
to find the pid of wvdial. Here's typical output:
Code:
Jake96@mybox Jake96 $ ps aux | grep wvdial
root      1082  0.0  0.3  2048  944 pts/1    S    21:51   0:00 su -c wvdial
root      1085  0.0  0.6  4776 1600 pts/1    S    21:51   0:00 wvdial
root      1103  0.0  0.3  1948  904 ttyS0    S    21:52   0:00 /usr/sbin/pppd 115200 modem crtscts defaultroute usehostname -detach call wvdial user jake96 noipdefault usepeerdns idle 0 logfd 6
Jake96    1377  0.0  0.1  1428  452 pts/7    R    22:32   0:00 grep wvdial


In this case, it's the second line, and the pid is 1085. Knowing this, I
Code:
su -
to root and
Code:
mybox root # emerge -uf --deep world && kill 1085 && emerge -u --deep world


Obviously not the most elegant way to handle it, but I'm not comfortable enough writing shell scripts to have automated it further. Big problem I see: if the fetchonly, first bit fails with the wrong exit status, the kill command won't execute. Hasn't happened yet, but it's entirely dependent on there being no problems with packages being found or with things passing the MD5 check (which each have happened to me before). So, please, feel free to improve on my poor method!
Back to top
View user's profile Send private message
Bowyakka
Tux's lil' helper
Tux's lil' helper


Joined: 04 Oct 2002
Posts: 142
Location: London

PostPosted: Mon Sep 15, 2003 11:30 am    Post subject: Reply with quote

two small improvemnets you might want to make
Code:
wvdial && emerge -f <pkg world etc> && killall wvdial && emerge <pck world whatever>


or if you dont want to use killall
Code:
wvdial && emerge -f <pkg world etc> && kill `pidof wvdial` && emerge <pck world whatever>


Also you can wrap the command in super user by doing
Code:
su -c " command here "

_________________
glows in the dark
Back to top
View user's profile Send private message
nephros
Advocate
Advocate


Joined: 07 Feb 2003
Posts: 2139
Location: Graz, Austria (Europe - no kangaroos.)

PostPosted: Mon Sep 15, 2003 12:30 pm    Post subject: Reply with quote

You can also store the pid of a launched process in a variable using $!, like so:
Code:

wvdial & wvpid=$!
... do something...
kill $wvpid

_________________
Please put [SOLVED] in your topic if you are a moron.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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