Ubuntu :: Using Variables In Hostname?
Aug 27, 2010
I'm have been tasked with created a base Ubuntu image that can be used for cloning to multiple machines. As this is a network environment, each hostname will obviously need to be unique. Rather than manually changing the hostname each time a new, cloned machine is rolled out, I was wondering if there is a way to use a variable in the hostname (i.e., use a variable to truncate the the last 6 digits of the MAC address to the end of the static hostname--or any other unique variable for that matter--so it would look like hostname00E6D4).
View 7 Replies
ADVERTISEMENT
Jan 3, 2010
I have a network of 2 WinXP machines and one linux box. I have fiddled around with the settings as you do when learning. The network is working. The network neighbourhood on the WinXP machines recognise the linux box and vice versa, (the linux Places|Network recognises the 2 WinXP). I can Ping the linux box using its hostname from a WinXp. But I cannot do the reverse. I get an 'unknown host' response. I can ping the linux to itself using its hostname.
View 7 Replies
View Related
Apr 6, 2011
mkvmerge -o <filename without extension>_TV.mkv -S <filename> && mkvextract tracks <filename> 3:<filename without extension>.*** && perl /home/brian/Desktop/ass2srt.pl <filename without extension>.*** && rm <filename without extension>.***
Doing these commands for multiple command line file inputs is the goal. So I can just type ./script.sh *.mkv in my terminal.This is what I have so far, but it doesn't work whatsoever.
View 2 Replies
View Related
May 24, 2010
I'm trying to ping another Ubuntu computer on my local network. If I try doing,ping <hostname>then I get the messageping: unknown host <hostname>however, if I doping <hostname>.localthen I get a response back. I was wondering how I can change it so that I can ping without having to append .localI've installed winbind and modified my /etc/nsswitch.conf file but this has made no difference.
View 2 Replies
View Related
May 22, 2011
I have an ubuntu 10.04 server with hostname "abc.domain.com". However, due to migration, we had to change to hostname to something else, "xyz".
I have done changing /etc/hosts and /etc/hostname and run /etc/init.d/hostname start.
Checking the hostname and all shows it is now using hostsname of xyz. However, email sending out is still using old hostname. We have some scripts that will send out alerts like failed rsync or hdd space full to my email account. But I see the sender is still "root@abc.domain.com".
How do change that to xyz? I am using postfix. I have edited main.cf and restarted postfix but no go.
View 1 Replies
View Related
Jul 29, 2010
I'm having an issue on two Fedora Core 13 machines where I can ping others by hostname, but the hostname resolution fails whenever I use ssh/scp/vnc/etc. I can still do these things by IP address, just not by hostname. RHEL5.3 machines on the same network with the same configuration do not seem to have this problem.
Here's the not-so-quick-and-dirty description of the situation:
I know that there is a virtual router at 192.168.31.1 and another at 192.168.30.1. I also know that there is another network (let's call it 90.90.90.0) and on that network lies a number of resources. By nature of this configuration, any machine on 90.90.90.0 can be accessed by any 192.168.x.x, but not the other way around. Beyond that is out of my hands and currently out of my scope of knowledge.
I have a dnsmasq server on 90.90.90.10 that operates as a secondary nameserver, another machine out of my sphere of influence is the primary nameserver (90.90.90.31).
The secondary nameserver on 90.90.90.10 holds the hostnames of our development machines. The problem is that in some cases, while I can ping by hostname all day long, services such as ssh, scp, vncviewer, etc all fail to resolve the hostname. In other cases I can do all of these things.
Every machine has an equivalent resolv.conf:
As an example, I will show the output of a handful of my development machines:
I also included columbia as a one-way test -- even though it cannot access 30.x or 31.x, they can access it:
columbia -- physical machine, Red Hat Enterprise 5.3, IP 192.168.100.200
Okay, so here are the various outputs. Remember, nibbler, discovery, and atlantis can ALL:
- Ping by IP address
- Ping by hostname
- ssh, scp, vnc, etc by IP addess
Additionally, the SERVFAIL reply from 90.90.90.31 is expected since my dnsmasq server is on the secondary server.
Note that the only machine that can both ping and ssh/scp/etc by hostname is nibbler, which also happens to be the only one of the three running RHEL5.3 instead of FC13. Other virtual and physical machines running on the 192.168.31.0 and 192.168.30.0 networks (all running RHEL5.3) work just like nibbler does. So the problem seems to only affect machines running FC13.
Final note: selinux is disabled, iptables is disabled, ip6tables is disabled.
Other than that, discovery is a brand-spanking-new install straight off of the FC13 DVD. atlantis has been around longer, but its just a file server so I haven't done anything too crazy to it.
View 3 Replies
View Related
Apr 6, 2010
How do I set $HOSTNAME to dynamically update with the hostname that is specified for the ip in DNS?
View 3 Replies
View Related
Jan 21, 2010
the difference between $HOSTNAME and $(hostname)?
View 5 Replies
View Related
Nov 2, 2010
I have a list of names (testnames.txt) and I have a set of log files (testlogdata.log). I'm trying to search the column in my log file for each of the names in my testnames.txt file, and output the result to individual files, name1.txt, name2.txt, name3.txt, etc the names in the column of my log file can appear in different formats , ie the name "Tom Smith" can appear as "tom_smith", "tom-smith", "ACME/tom.smith", "ACME/thomas.smith". etc. To allow for the variations, I have my names in the testnames.txt as expressions, ie, for tom smith, I use the expression "to.*smith", etc.I'm running the following command:
for i in $(cat testnames.txt); do awk '{if ($9~/$i/) print $0}' testlogdata.log > $ioutput.log; done
I want the command to read a value for i, insert it into the if ($9~/inserted value for i/, and dump each line from testlogdata.log into a file named <value-for-i>output.log.
View 4 Replies
View Related
Feb 11, 2011
Turns out I don't have bc in my Ubuntu distro and I can't install it. how to subtract two variables (BASH variables) from awk and set the result as another variable, e.g: finalvalue=`awk '{print $first - $second}'`
View 2 Replies
View Related
Mar 24, 2010
I am trying to use bash 'printf' to format an environment variable.Doing this I get on the screen just the format I need (underscores mean blank spaces):prompt> printf "%10s" "1.23"________1.23Unfortunately, when this is assigned to a variable, the format disappears:prompt> X=`printf "%10s" "1.23"`prompt> echo $X1.23Does anyone know what can be done in this case to get a proper format?Why does not 'printf' respect the left blank spaces when assigning values to a variable?
View 3 Replies
View Related
Jun 20, 2011
I have what I hope is a fairly simple question to answer. In my ~/.bashrc file I can create this alias:
Code:
alias uChmodDP='chmod -R $1 $2' #specify permissions. and the variables work fine. But I cannot seem to get any love from this alias:
Code:
alias umnt='umount /dev/$1' I realize the likely problem is the variable following hot on the heels of a specific directory, but is there anyway to specify a variable in an alias like this? For some reason I cannot umount usb pen drives by right clicking, and have to always resort to the terminal to do so, which for me is no real biggie, but if I could create this alias it would be an even better no biggie to umount using the terminal.
Actually, the inability to right click to umount usb devices seems to be a Thunar issue since I run xubuntu. Using Nautilus I am able to right click and eject/safely remove devices. Using Thunar however, right click unmount always pukes back an error that the device must have been mounted on the command line or some such BS. But like I said it is no real biggie to use terminal, but an alias would be even nicer. I prefer using Thunar and Xubu most of the time b/c my laptop is quite underpowered.
View 3 Replies
View Related
Mar 24, 2010
I just set up a new karmic server, and the hostname is being set properly, but I'm not exactly sure how, since there is no longer an init script that sets it (it used to be /etc/init.d/hostname.sh on my older servers). Now I'm curious: what is the new mechanism by which the server's hostname is set at boot time?
View 3 Replies
View Related
May 3, 2010
How i put `hostname` in uppercase in this case:date +"%Y%m%d%T" > date_`hostname`.txt Best wishes,Andr Barradas
View 3 Replies
View Related
May 14, 2010
I just have a simple question. When I installed Lucid a few weeks ago, I didnt feel very inspired, and thus left the host name at default. I just changed the hostname today, and I discovered that I can no longer resolve the host for ssh connections to the computer. When I changed the hostname files, I followed this guide: [URL].. Is there a file that I need to change regarding SSH that has a hostname in it?
Specifically, Im trying to ssh and VNC connect to the Ubuntu box from my iPhone. I have a PuTTY client installed on it (from the app store, called iSSH) and up until now, it worked.
View 9 Replies
View Related
Dec 4, 2010
Ubuntu 10.10 64 bit
I need to set /etc/hostname and /etc/hosts so that on running;
$ hostname
Code:
ub1004
$ hostname -a
Code:
ub1004
[Code]....
View 2 Replies
View Related
Jun 2, 2010
I know many people have asked about environment variables before, but I am having a hard time dealing with these paths while ensuring I don't mess around with the original settings. How would you go about executing these commands in Ubuntu in terms of environment variables?
put /home/stanley/Downloads/ns-allinone-2.34/bin:/home/stanley/Downloads ns-allinone-2.34/tcl8.4.18/unix:/home/stanley/Downloads/ns-allinone-2.34/tk8.4.18/unixinto your PATH environment; so that you'll be able to run itm/tclsh wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put
/home/stanley/Downloads/ns-allinone-2.34/otcl-1.13,
/home/stanley/Downloads/ns-allinone-2.34/lib,
into your LD_LIBRARY_PATH environment variable.
[Code]....
View 1 Replies
View Related
Feb 12, 2010
In terminal, I use the command " export XXX="xxx" " to create a new environment variable, and then " env | grep XXX " to check if it is existed. But when I run the terminal again, the variable I created is disappeared. I've found it just can't save the variables I created..
View 3 Replies
View Related
Mar 15, 2010
I can't seem to find how to export a variable to all processes I run under my user? I have an application that needs this variable, and currently I have to manually export this variable (typing "export VAR=... in terminal) every time before I run the application.
Which profile file I have to put the export expression into? I want all processes to inherit this variable, not just the shell/terminal. I.e. a true environment variable...
View 7 Replies
View Related
Mar 29, 2010
With my .conkyrc. Whenever I output the values of any of the mixer variables, eg. mixer, mixerbar, mixerl, mixerlbar, mixerr, mixerrbar - the correct value is initially displayed but it only persists for one iteration of conky. As soon as conky refreshes (2 secs. in my case), the value goes to zero (0). I'd have to restart conky in order to get another reading until conky loops/refreshes again.
I'm sure that it's not normal behavior because nothing else in conky seems to work this way. Has anyone come across this? I couldn't find a mention of it anywhere.
View 5 Replies
View Related
Apr 7, 2010
I've created a new environment variable and updated another one (PATH). I just want to save this changes once after reboot and forever. This is because I want to run a program (tecplot) just typing 'tec360' in the command line. If I create those new variable ( TEC_360_2008=/usr/tec360_2008 ) and update the PATH variable ( export PATH=$PATH:$TEC_360_2008/bin ) then bash detect the command 'tec360' and it runs my program. The problem is that this changes are not saved after rebooting.
According to the manual, I have to update the .bash_profile in my home directory but I don't have this file in this directory (neither in other directory). I only have .bash_history, .bash_logout and .bashrc in the home directory. I have updated .bashrc (typing . ./.bashrc) but it is not working.
View 5 Replies
View Related
May 13, 2010
I need to set some custom environment variables.
View 6 Replies
View Related
Jul 19, 2010
When I execute something with sudo, the environment that it executes in doesn't have all the environment variables from /etc/profile{,.d/} defined. I googled around and found that there is a way to get the environment variables from the calling environment to be carried over to sudo's own environment, but that's not exactly what I want. I just want sudo to read the /etc/profile and /etc/profile.d/ before executing commands.
View 2 Replies
View Related
Mar 27, 2011
"Once upon a time", I think heard of a way to use variables in the url field in firefox(or maybe it was ubuntu in general?).Anyways, if one would type, for instance, "google pokemon," the url would be changed to
View 2 Replies
View Related
Apr 28, 2011
I'm having a strange problem. I'm using Ubuntu server 10.04 LTS and I want to setup a system with 2 network interfaces: eth0 and eth1. However eth1 does not come up at boot I have a screenshot of my /etc/network/interfaces file I don't see what is wrong. eth0 gets it's adress from DHCP eth1 gets a static adress. When i try to restart networking it quits with this message "don't seem to be have all the variables for eth1 inet" Can anyone point out what I'm doing wrong? if i do 'sudo ifconfig eth1 192.168.3.1 netmask 255.255.255.0 up' eth1 comes up
View 3 Replies
View Related
May 9, 2011
Does anyone know what file I have to modify to set the environment variables for FSCK? I can't run FSCK on my file system because it runs out of memory after about 10 minutes. This variable sounds like it will solve all of my problems but I can't find the file to modify to set the variable or what parameters it takes (number? yes/no?, etc).I'm trying to recover has a lot of information on it that I would really like to get back.
View 4 Replies
View Related
Jun 9, 2011
I want to be able to grab some text from a directory listing in a bash script, and then apply that text to future commands in the same script. For instance, say I do "ls -lais /media/Movies" and get:
2147560409 712544 -rwxr-x--- 1 root users 729645056 1999-03-07 11:45 Young Guns (1987).avi
2147560410 712400 -rwxr-x--- 1 root users 729497600 2002-01-09 01:11 Young Guns II (1990).avi
Then say I want to grab the year from this output and then use that information as part of the command to modify the file timestamp, such as:
touch "Young Guns (1987).avi" -t 198701011200
touch "Young Guns II (1990).avi" -t 199001011200
So that the result of ls -lais is:
2147560409 712544 -rwxr-x--- 1 root users 729645056 1987-01-01 12:00 Young Guns (1987).avi
2147560410 712400 -rwxr-x--- 1 root users 729497600 1990-01-01 12:00 Young Guns II (1990).avi
Anyway, that's just one example, but I often find myself needing to do this type of thing, and I'm sure its possible, just not really done enough scripting recently to know how to do it.
View 5 Replies
View Related
Jul 4, 2011
I always have to google about setting environment path variables when I install new software. My basic problem is that I dont know whether these variables need to be set globally or not. I have read a number of mails/tutorials which say that Environment variables should be set by simply doing an export ..eg EDITOR=nano export EDITOR
additionally I have read that it should be written into /etc/bash.bashrc
But are these really global variables or local? I want the variables to be set
even after I have logged out.
so I could also write the variable here...
/etc/environment
or here
/etc/profile
View 1 Replies
View Related
Jul 25, 2011
I'm trying to write a bash script, and for some reason Bash doesn't seem to like any of my variables _except_ the one used in a loop.What's going on? The same problem with MYS occurs regardless of its name, whether it is declared or referenced before, after, or inside the loop, and whether it is a string, integer, or floating-point number. Also, as far as I can tell, everything related to Bash is up to date.
View 7 Replies
View Related
Jul 26, 2011
I am trying to use the following bash alias:
I've been able to get this working under mac and solaris.
I've also tried not escaping the vars.
Anyone know if this is doable with ubuntu's bash shell? (or any meaningful workaround other than writing a script for this?)
View 2 Replies
View Related