[PLUG] Can I make a link happen automatically?
John Jason Jordan
johnxj at comcast.net
Thu Mar 9 17:35:50 UTC 2006
On Wed, 8 Mar 2006 09:09:18 -0800 (PST)
"Michael Rasmussen" <mikeraz at patch.com> wrote:
> Another common element is that with each change your network interface goes down
> and comes back up.
>
> You're running Ubuntu right? /etc/network/ifup.d (from memory, I'm at work and
> there's nothing but Solaris and Windows around me) contains scripts that are
> executed whenever the network interface comes up. If you include your ln ...
> command in one there the linking would happen automagically evertime the interface
> came up, no matter where you were.
This sounds like a great idea. However, I'm not sure which script to
edit. In /etc/network I have the following tree:
if-down.d
postfix
if-post-down.d
wireless-tools
if-pre-up.d
wireless-tools
if-up.d
postfix
run
ifstate
interfaces (file)
options (file
Assuming it was the right file, I opened the if-up.d/postfix file in
gedit. Its contents are:
---------------------
#!/bin/sh -e
# Called when a new interface comes up
# Written by LaMont Jones <lamont at debian.org>
RUNNING=""
# If master is running, force a queue run to unload any mail that is
# hanging around. Yes, sendmail is a symlink...
if [ -f /var/spool/postfix/pid/master.pid ]; then
pid=$(sed 's/ //g' /var/spool/postfix/pid/master.pid)
exe=$(ls -l /proc/$pid/exe 2>/dev/null | sed 's/.* //')
if [ "X$exe" = "X/usr/lib/postfix/master" ]; then
RUNNING="y"
fi
fi
# start or reload Postfix as needed
if [ ! -x /sbin/resolvconf ]; then
cp /etc/resolv.conf $(postconf -h
queue_directory)/etc/resolv.conf if [ -n "$RUNNING" ]; then
/etc/init.d/postfix reload >/dev/null 2>&1
fi
fi
# If master is running, force a queue run to unload any mail that is
# hanging around. Yes, sendmail is a symlink...
if [ -n "$RUNNING" ]; then
if [ -x /usr/sbin/sendmail ]; then
/usr/sbin/sendmail -q >/dev/null 2>&1
fi
fi
<sudo ln -f /etc/resolv.conf /chroot/breezy/32bits/etc/resolv.conf>
-----------------------
Not knowing anything about programming the text means nothing to me,
but I'm guessing I should just add my link command at the bottom and
resave it, like the above < > line that I added, right?
> That thought "I need to automate the process somehow." That's a good one. Hold
> on to it. Great attitude to take.
That's how I'm learning Linux. When I need to do something I take
the time to figure it out. Slowly but surely I add to my knowledge and
skills. Learning it on an as-needed basis automatically ensures that I
will learn things in order of importance. Except for a couple things,
that is -- e.g., firewalls and backups.
More information about the PLUG
mailing list