General :: Desire Trick To Modify Hostname In Shell Script
Mar 28, 2011
I am looking an neat trick / elegant solution to manipulate / modify hostname and set a variable to the value inside a script.I have figured what I want to do.I just want to know how to set the variable correctly ?
View 1 Replies
ADVERTISEMENT
Apr 12, 2010
I have a file like below
n
p
1
1
50
w
I need to modify the first occurence of 1 byt some other integer.How do i do it using shell script?Can anybode help me out with that?
View 9 Replies
View Related
Jun 22, 2010
I want to modify a file like /etc/gdm/custom.conf from the shell or a script.
# GDM configuration storage
[xdmcp]
[debug]
[daemon]
AutomaticLoginEnable=true;
AutomaticLogin=username;
But the idea is that I can add a line to a section and it check if the section is defined, (add the definition if not), the property is defined, let it undefine (erase the line), (and delete the section header if there is no property defined), etc...
I didn't find anything except gconftool-2 but it do not explain how to modify other files. (there is a shema file there).
there isn't a program/script to achieve this, but can easyly be made for every config file, If someone do something like that, with a little database of which markup use each file, it could become really popular.
View 3 Replies
View Related
Jan 10, 2010
where we can find the script trick, i found once before then lost it and i search a lot but cant find again.like people do fun and play while learn with script basic. i am talking about shell
View 5 Replies
View Related
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
Dec 3, 2010
I'm running RHEL5.5 and nagios 3.2.0. The real question deals with how to change the printed output so nagios will work with it.I have made a script that will calculate network throughput on interfaces. The script is going through and finding all interfaces (eth, bond, lan) and doing the math to calculate throughput.The output is mainly for nagios to report and trend the values. As nagios wants to see nothing but perf data after the '|' character, I somehow need to have only one '|' character for all of the output.
View 2 Replies
View Related
Jan 27, 2011
how can i manually modify source.list to include debian repository from shell.since xorg isn't installed yet and the cd doesn't work well.
View 5 Replies
View Related
Sep 2, 2011
i need to add a line in the login start up file(s) (one of ~/.bash_profile, ~/.bash_login, or ~/.profile) and startup file run by my shell when started as a non-login shell (~/.bashrc) so as to set up my account envirnoment for one of my courses.I don't know how to proceed with this. I tried doing this in my ubuntu enviroment and my system got locked after that.
View 3 Replies
View Related
Apr 14, 2011
There is a file with that format of each models' information.I don't think that's good format, but I cannot change that format. I needed to modify the model name, 'model = xxx' as 'model = abc'.And I don't know how to parse and modify 'model = iii' and 'model = ddd'.The only clue to parse 'model = ddd' is the second 'model = ' after the second 'system information'. But how to parse the second keyword?Is it possible with 'sed'?I sometimes have to modify the information of the file.using shell script if possible.Python is ok. (Shell script is better for me.)
View 15 Replies
View Related
Jan 21, 2010
the difference between $HOSTNAME and $(hostname)?
View 5 Replies
View Related
Jul 30, 2010
OpenSUSE claims that OS11.3 support sync with Android.
Anyone manage to successful set up sync with HTC Hero/Desire?
View 2 Replies
View Related
Jun 3, 2010
To take a screenshot(or partial screenshot), I use to use the command-line, type "import <filename>.png" and then "alt-tab" away from the console (for me, xterm) and then (usually) select a part of the webpage showing up on the browser. However, I find in my modern X-window installations (I use osuse and slackware, with several window managers: xfce, icewm and awesome) the alt-tabbing bit doesn't work any more.To get by, I have to reduce the size of the console so that the bit I want to capture is visible as I write the import commandI figure this is an X problem, but it could also be an imagemagick problem (on that subject, I think I'm going to try out graphicsmagick soon)
View 2 Replies
View Related
Mar 13, 2010
I want to jail Skype into its own process and not the one I login with. That way, if a hacker breaks in, it's limited to this process and only the limited functionality that that user account has. The thing is this -- thousands of Linux guys run Skype, but Skype is hardly ever updated or have security patches, and we run it all the time. It seems like an easy avenue for an exploit. As well, my iptables firew all blocks input connections that I have not established, but Skype is an established connection. How do I create a Bash script that launches Skype under a separate user account?
View 3 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
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
May 7, 2010
I have installed unbuntu 10.04.. since i dont want grub to boot my linux distros , i have installed the bootloader in the root partition (sda9 in my case with no separate partition for boot). Subsequent to successful ubuntu installation i booted using the live cd and extracted the boot loader using the following.
dd if=/dev/sda9 of=/ub.bin bs=512 count=1
Finally i edited the boot.ini (win xp) to show ubuntu in the menu which points to ub.bin.
But this doesnt seem to work... the same had worked with Mandriva 2010
Where did i go wrong ?
View 6 Replies
View Related
Oct 10, 2010
I have this weird program: dns2tcpc (creates a dns tunnel). I would like it to run at startup. However, I found that the program doesn't work when backgrounded! EX: dns2tcpc -z dns.domain.com -l 8888 208.67.222.222 Works, and I can use SSH to port 8888. However, if I try to background it, like: dns2tcpc -z dns.domain.com -l 8888 208.67.222.222 & Then trying to connect to SSH won't get any response
Now, I know this is a bug in dns2tcpc, and I really don't feel like compiling it or anything (I may have to), so is there any way to "trick" an application into thinking it's running in the foreground (like typing the command from the terminal window)? (Bonus if no addition installation is required)
View 2 Replies
View Related
Apr 8, 2010
I think that the kde4.x clipboard is mishandled. using any method of copy from a kde app causes the data to be cut instead of copied when pasted into another app (even non kde). Non kde apps behave as expected.
open gedit and kwrite.
type K in kwrite.
Type G in gedit
highlight the G in Gedit
(select copy or use primary)
middle click or paste into kwrite.
fine - there's a G in both editors.
Reverse, copy the K from kwrite and copy paste it into gedit. when you go back to kwrite the K is gone! Evil Magic. what's up? Can't wait until kde 5 or 6 when t gets to be usable again.
View 9 Replies
View Related
Jun 15, 2011
MACHINE: HP Proliant DL260G5OS: SLES 11 SP1kernel: Linux xserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxIt is used as remote xserver in a LAN.I have configured /usr/lib/restricted/bin/.rbashrc with some environment variables but when the users logon in the system finally is executed $HOME/.bashrc and some environment vars are overwritten.
View 2 Replies
View Related
Apr 27, 2011
I would like know when it is necessary or advisable to write a shell script instead of shell function ?
View 3 Replies
View Related
Apr 29, 2010
installed the 9.10 Version of ubuntu. Now the situation is: Four Computers are running under Windos XP-professional SP3 My computer, the fifth has ubuntu as os After the upgrade to ubunto 9.10 (with the newest updates installed today) I`m unable to access the windows network. Shows me only windows network but when I click on it no list of workgroup is shown and therfore the network cannot be connected
Only with one "trick" get access: connect to server, then putting the ip's of th windows computers I've got connection to all allowed dir of all the four windows computers (location: smb://ip-adress) To install a network printer is impossible neither with cups nor with system-> adaministration->print At my computer is one printer which works fine. the other printer a Xerox Phaser 6110 is connectet to one XP computer and is configured as network printer under Windows. The computer (IP-Adress is found but that is all) Printer is not connected.
Trying now for three days I'm really upset because there is one golden rule: Never touch running Systems! But you folks from ubuntu must bring ever second day some updates. Nothing against this, but configure your updates in that manner that the updates don't change all my settings. When I boot my computer with windows-XP all network computers are there and usable. My Samba config is ok too because otherwise I would not be able to connect to windows computer through the above mentioned trick.
View 6 Replies
View Related
Jan 18, 2011
I am wondering if I can open a shell or new terminal thing from within the terminal in a unix/linux enviroment. Particularly a commandline only one where there is no GUI. Is this doable? how do I do it?
View 3 Replies
View Related
Jan 21, 2010
How do I get thread_info for a given pid? Is there a way to modify PC of thread A in thread B so once thread A is scheduled, it will jump to the new instruction?
View 2 Replies
View Related
Jun 22, 2010
When we execute rm command then the target files or directories are permanently removed from our computer.
Is there any way my which when we execute rm command then the files or directories moved to Trash.
View 13 Replies
View Related
May 13, 2010
I need to modify a file that contains \tsus.fbfs.comappsdataStormLossProduction and replace the \tsus.fbfs.comappsdataStormLossProduction line with rm -f /mnt/nfsvol/PC/SLR/
I have tried:
But it provides an error on the second . I need to change this in place and not redirect to another file.
Is this possible? I have used sed and awk before but not extensively.
View 7 Replies
View Related
Jul 7, 2010
I'm using Ubuntu 10.04 LTS
By typing the command:
hostname --fqdn
I get the following
hostname: Name or service not known
As requested by Raphaƫl Hertzog
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
[Code].....
View 3 Replies
View Related
Apr 12, 2010
I have some problem some one changed hostname on my system. If I do following I see
Code:
knoppix:~# cat /etc/hostname
debian
knoppix which is coming in left side in above output is not my hostname.
The hostname is debian.
How do I get that name back so that when I do cat /etc/hostname output is like following.
Code:
debian:~# cat /etc/hostname
debian
View 4 Replies
View Related
Apr 14, 2011
I've installed a new copy of Ubuntu 10.10.Now the big question for me is how do we assign hostname to a given ip? I've given the hostname during the server installation and "cat hosts" says "ebox" hostname I'm trying to put on.Also,I modified the network/interfaces to static and assigned proper values.
#hostname returns ipaddr not the hostname. Also nslookup hostname/ipaddr says server can't find ....
So,is installing dns through bind and setting-up the only way to do that?
View 9 Replies
View Related