WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: change the hostname, make it permanent and replace tc@box when booting from CD  (Read 25821 times)

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: change the hostname, make it permanent and replace tc@box
« Reply #15 on: March 14, 2011, 12:20:49 PM »
Put it into bootsync.sh instead of bootlocal.sh.
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11618
Re: change the hostname, make it permanent and replace tc@box
« Reply #16 on: March 14, 2011, 03:12:06 PM »
Hi beerstein
Actually, the problem is with my implementation. I just went out to the garage and turned on the monitor
on my file server and saw I have the same black screen with a white x for the cursor. I normally make
changes to the server using SSH via a terminal so I didn't notice the GUI wasn't coming up. Try curaga's
suggestion of moving the changeh.sh entry from bootlocal.sh to bootsync.sh. I can't test it for you since
my server is running version 2.10 and doesn't use bootsync.sh, so I'll have to figure out something else
if I want to fix it on my machine.

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Re: change the hostname, make it permanent and replace tc@box
« Reply #17 on: March 15, 2011, 06:55:51 AM »
Put it into bootsync.sh instead of bootlocal.sh.
Hi curuga and Rich: Thank you so much for your help. The above did the trick. Now I have my system working and tc@box2 shows up where it is supposed to. I can recommend this modification to everybody using TC in a network with more than one TCs installed. As I previously said, booting from hd --> use the boot code in menue.lst, if you only boot once in a blue moon frm a live CD, use F2 and type: tinycore host=boxX    for X=1...n

t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Hi there:
One more thing. The script works fine now, but I discovered something which want you to know.
Here is the script gain:
#!/bin/sh
#original script EOT changed to EOF
NEWNAME="box2"
echo $NEWNAME > /etc/hostname
hostname -F /etc/hostname
cat > /etc/hosts << EOF
127.0.0.1 $NEWNAME localhost
EOF
This script writes: 127.0.0.1 box2 localhost  into /etc/hosts this way all modifications of the file hosts are lost after reboot. So if you use this script and have your other hosts (fixed IP) listed you must include the hosts into the script above.
example:
#!/bin/sh
#original script EOT changed to EOF
NEWNAME="box2"
echo $NEWNAME > /etc/hostname
hostname -F /etc/hostname
cat > /etc/hosts << EOF
127.0.0.1 $NEWNAME localhost
192.168.1.4   box1
192.168.1.5   box3
#..... and so on
EOF

While using a host name other than box I think I ran into some problems with cups.
printing from leafpad, mousepad, Gnumeric - error message in Leafpad is: "No application is registered as handling this file".
Printing works fine in Abyword, Office Writer and Geanny-editor.
t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Hi all:
with the new rc1 of TC3.6 robert made provisions to set the hostname in an easier way. Did somebody already make use of it and knows how to to it?
If yes, pleae share. Thank you so much
t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Code: [Select]
$ cat /opt/bootsync.sh
#!/bin/sh
# put other system startup commands here, the boot process will wait until they complete.
# Use bootlocal.sh for system startup commands that can run in the background
# and therefore not slow down the boot process.
/usr/bin/sethostname doublewide
/opt/bootlocal.sh &

Note: Using boot parameter takes precedence.
10+ Years Contributing to Linux Open Source Projects.

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
thank you roberts:
I hope I got that right.

So when I boot the first time via CD/DVD and have tce=hda1
I use the bootcode for hostname=newbox2
After that this new hostname is fixed and stays in /etc/hostname?
t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
No. 
Roberts showed you the /opt/bootsync.sh file with the required sethostname line added.

Offline beerstein

  • Hero Member
  • *****
  • Posts: 530
Thank You:

Using a boot CD, I just booted with /tce in hda1 and then I modified the line in /opt/bootsync.sh  file into:
/usr/bin/sethostname box7

After reboot the system carries the new hostname: box7

t(w)o be(ers) or not t(w)o be(ers) that is the question