Running command "hostname mysite.com" at startup?
Hi,
I want to run this command at the startup since my system keeps resetting the hostname to "ubuntu" upon startup. I tried adding it to crontab under "@reboot hostname mysite.com" and it would not work, it would work if i set cron to "* * * * * hostname mysite.com" but that means I have wait 1 minute after machine boots plus, it keeps running every minute on a schedule which is not good practice. Where abouts am I supposed to run this command? |
To change the hostname permanently you have to edit the file /etc/hostname and write the new hostname then run
Code:
/etc/init.d/hostname.sh restart |
It looks like it works if I do "crontab -e" and enter:
@reboot /bin/hostname mysite.com && /bin/echo "nameserver 4.2.2.2" > /etc/resolv.conf But how can I be sure these will happen in the last order or the scripts that get run at startup? I don't want them to be overwritten by the default "nameserver ubuntu" or whatever that gets run. Changing it using your command doesn't save when you reboot either it looks like. |
Quote:
|
Hi,
I would also be careful with using 'third' level DNS. Not always there. You can always your ISP DNS then append to your file '/etc/resolv.conf' by 'echo "nameserver 4.2.2.2" >> /etc/resolv.conf'; Code:
~# echo "nameserver 4.2.2.1" >> /etc/resolv.conf |
Quote:
|
Hi,
Quote:
Quote:
|
Quote:
I have been using that address for DNS for a long time. Does this mean it's not recommended to use it or it's unreliable? I do understand what top level, second level, third level mean in domain names (like zone.third.second.com) but didn't know what it means for an IP address such as 4.2.2.2 |
Hi,
Read the links that I provided. You should be using your ISP 'DNS'. There are several third level DNS available; Quote:
The above link and others are available from 'Slackware-Links'. More than just SlackwareŽ links! |
All times are GMT -5. The time now is 02:34 AM. |