lpd problems

Place to discuss Fedora and/or Red Hat
Post Reply
Ice9
guru
guru
Posts: 577
Joined: Thu Jan 09, 2003 12:40 am
Location: Belgium
Contact:

lpd problems

Post by Ice9 » Sun Nov 02, 2003 2:39 pm

A while ago I moved to another town while keeping the same ISP.
Internet connection was up, connected my machine and I was on the Internet.

After a few days I got an lpd error when I booted and shut down my pc

lpd: 2003-11-02-21:25:34.347 Get_local_host: hostname 'dhcp-****-***' bad

When I tried to restart lpd it failed.
I found a workaround by editing my /etc/hosts file and adapting my hostname to the name I got when running the "hostname" command in a shelll, and it worked for a few weeks.

Now I got the same error again, of course my hostname has changed to 7 other digits and I suspect that if I edit my /etc/hosts file and adapt the hostname I will be fine again until my ISP updates it.

Is there any way to fix that once and for all, I never had a problem with that in the two years before I moved ...!

Also, can I change my hostname to something else than those digits assigned by my ISP ?
I see screens all the time with all kinds of hostnames but I don't knwo if I can change mine without causing havoc.


Update: just as I thought, editing the /etc/hosts file and do a "service lpd restart" fixed it, but until when?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sun Nov 02, 2003 7:13 pm

Do you actually use lpd? If you don't then turn it off. Otherwise this should help:

https://lists.dulug.duke.edu/pipermail/ ... 12907.html

Ice9
guru
guru
Posts: 577
Joined: Thu Jan 09, 2003 12:40 am
Location: Belgium
Contact:

Post by Ice9 » Mon Nov 03, 2003 2:21 am

Thanks, I'll try that tonight.

As for using lpd, I was under the impression that I needed it to be able to print, but I can't verify that until I go out and buy some printer cartridges, mine have been empty for a few months now.

ZiaTioN
administrator
administrator
Posts: 460
Joined: Tue Apr 08, 2003 3:28 pm
Contact:

Post by ZiaTioN » Mon Nov 03, 2003 2:47 pm

Here is another method you might think of if you cannot get your hostname to quit changing. I wrote a little script for you to use to auto update your hostname resolution. You can drop it in a cron job and have it run hourly or daily or whatever.

I wrote and run a similar one for my dynamic IP address that is a little more in depth than this one as in it emails 2 of my email accounts along with updating the system files I needed to update. I have it email me so if I am at work and it changes I can ssh into the right IP address for remote access.

Anyway here is this script. It might need some twekaing for your specific system but should work good as is if the file paths are correct.

Code: Select all

#!/usr/bin/perl

use strict;
my($command, $create, @results, @current);

chomp($command = `hostname`);
$create  = `touch /etc/cron.hourly/hostname.txt`;

@results = print $command;

if (-e "/etc/cron.hourly/hostname.txt") {
   open (file, "</etc/cron.hourly/hostname.txt");
   @current = <file>;
   close (file);
}else{
   print $create;
}

if (@current !eq @results) {
   open (hosts, ">/etc/hosts") {
   print hosts "127.0.0.1               localhost.localdomain localhost @results\n";
   close (hosts);
}
Now mind you this will overwrite the hosts file each time the if statement is satidifed. If you want to just append change the ">" to ">>" in the open statement. I do not think multiple resolutions to the same address will be mrecognized though if it is on seperate line so tweak how you need it.

Hope this helped.

Ice9
guru
guru
Posts: 577
Joined: Thu Jan 09, 2003 12:40 am
Location: Belgium
Contact:

Post by Ice9 » Mon Nov 03, 2003 3:03 pm

Thanks for the script, but I haven't had the chance to see anything yet
(see my most recent post about X troubles)

I'll try to fix that first and then I will try to take care of the lpd thingie :wink:

Post Reply