I have been making use of a great set of Bash log in scripts that a co-worker came up with. The scripts check various things to determine what platform, host or location that it is being executed on to set things up appropriately. It works beautifully on my Redhat, Ubuntu, and Debian systems, but my OpenSUSE 11 system was exhibiting a problem.
These scripts are hooked into the normal Bash startup procedure by having .bashrc and .bash_profile symlinked to the startup script. This ensures that they will be run regardless of the type of login (as long as it’s interactive). This works fine on all the other systems since only one of .bashrc or .bash_profile is sourced depending on whether it is a login or non-login session. Or at least that’s how it’s supposed to work (man bash).
The good people at Novell decided to break with this tradition. In /etc/profile they go and source ~/.bashrc calling it a “nice thing”! – http://developer.novell.com/wiki/index.php/Bash_-_What_happens_when_you_invoke_bash
This has the effect of having all these login scripts run twice on OpenSUSE. So, for example, I have to enter the password twice for my ssh key and certain things get displayed twice. I’ve got a crappy work around in place for now, but I really just wish things were left as they were intended.
Filed under: opensuse , bash, login, opensuse
It might be useful to include an absolute time stamp when pinging multiple hosts so as to be able to make a correspondance later on. This is what I put together in a hurry that does the trick.
while test 0; do DATE=$( date | tr -d '\n' ); \
PING=$( ping -c 1 192.168.1.100 | grep from ); \
( echo $DATE $PING; sleep 1 ) | tee -a /path/to/log ; done
Got a better way to do this? Post a comment.
Filed under: network , network, ping, timestamp
I mentioed in a previous post how cool it was that you can download src rpms with yumdownloader. I didn’t realize until a couple of days ago that it is not able to grab src rpms from the Redhat Network – at least the way my RHEL 5.3 yum config is setup.
Following the suggestion here I added a repo config file specifying the location to grab the src rpms, but that was unsuccessful.
I decided to take a look at the code behind the tool (/usr/bin/yumdownloader) and this is what I found:
# Ok, we have src and bin repos. What we want to do here is:
#
# 1. _enable_ source repos for which the bin repos are enabled.
# 2. _disable_ the _other_ src repos.
(this is from the version of yumdownloader that comes with yum-utils-1.1.16-13.el5.noarch)
So only source repos must be paired up with “bin” repos. That explains why the previous attempt to solve this problem didn’t work as it was a standalone repository.
So why not add a source repo section to the config for the Redhat Network repo? Well, the Redhat Network repo settings come as a part of a plugin (rhnplugin) that does not have repo config files that you would see in /etc/yum.repos.d. From inspecting the /usr/lib/yum-plugins/rhnplugin.py I also didn’t see anything related to src rpms (though I did only a cursory inspection).
The solution I put in place was to setup a dummy (empty) yum repository to pair up with the src repo. This just requires running ‘createrepo .’ in an empty web accessible directory. With that in place the following config worked:
[rheld]
name=Red Hat Dummy
baseurl=http://your.domain.com/yum/dummy/
failovermethod=priority
enabled=1
gpgcheck=0
[rheld-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Filed under: Sysadmin , redhat, rpm, yum, yumdownloader