Shell script as a daemon

Ever need to have a bash script put itself to the background on startup. Some call it daemonizing..

if [ "x$1" != "x--" ]; then
$0 -- 1> ~/myscript.out.log 2> ~/myscript.err.log &
exit 0
fi
Posted by on May 18, 2010 in Brain Purge .. | Comments Off on Shell script as a daemon

Cisco IOS Commands I forget

These are a few of the Cisco IOS commands that I seem to forget, as I rarely use them, and when I need them can never seem to lay may hands on them. Thats one of the things I hope to start remembering as I use the CLI more …

logging synchronous
exec-timeout 0 0
no ip domain-lookup

Basically the logging synchronous command allows you to have the console showing debug output and keeps your command that you are typing visible on the cli, instead of being caught up in the debug output.

The exec-timeout 0 0 line stops your terminal session from timing out. Suggest you only use this for situations that you trust your terminal is secure, otherwise someone else may continue to use it if you forget to log out.

no ip domain-lookup for the times that you miss type a command, this will stop the miss typed command from being looked up in the DNS system.

Posted by on January 26, 2010 in Cisco, networking | Comments Off on Cisco IOS Commands I forget

Fedora eth0 to eth1

If you ever find your self wondering why your replacement ethernet NIC is being renamed from eth0 -> eth1, then check out the file /etc/udev/rules.d/70-persistent-net.rules.

It contains lines like the following…

# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
 
# PCI device 0x1106:0x3065 (via-rhine)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:40:63:eb:9c:10", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

Obviously, you need to change the MAC address in there to get it all working.

/sbin/ifconfig eth1

There maybe a tool for this, but I have not had time to go digging for that yet ..

Posted by on November 21, 2009 in Brain Purge .. | Comments Off on Fedora eth0 to eth1

Website and download Mirrors

Hello All,

Due to a lack of spare time and resources, I will no longer be providing the mirrrors for websites and download mirrors.

Thankyou  to all that have assisted and contributed over the years the mirrors have been operating. These mirrors are scheduled to be removed on 1st December. Please arrange for alternate download sites to suit your needs.

Darrin

Posted by on October 17, 2009 in Brain Purge .. | Comments Off on Website and download Mirrors

Setting timezone in CentOS, RHEL, Fedora

This is one of those things that I occasionally need to do, but always seem to forget.

I usually hit Google to find these commands and the process, however everyone seems to want to link to the /etc/localtime file instead of copying the file.  As this file is a main system file you need to ensure it is available at all times, so if you link accross a filesystem that becomes unavailable or corrupt, you potentially end up having issues while you try and recover your filesystems.

First step, find your time zone in /usr/share/zonedata, for me this is

/usr/share/zoneinfo/Australia/NSW

Note that your timezone may be in a subdirecory of /usr/share/zoneinfo, as mine is shown above. Now the easy bit, copy the zone file to /etc/localtime, the following command should do it..

sudo cp -a /usr/share/zoneinfo/Australia/NSW /etc/localtime

If you have trouble running the above command, you could always use the following process, bit longer but, still gets the same outcome ..

sudo cp -a /usr/share/zoneinfo/Australia/NSW /etc/localtime
cp: overwrite `/etc/localtime'? y

You should now be able to run date and make sure your timezone settings are correct.

date
Sun May 17 09:41:25 EST 2009

Next, to ensure thie stays persistent across glibc updates, set the correct timezone in the clock config file.

sudo vi /etc/sysconfig/clock

Well, that should help me when I have to go through this process again, hope it helps someone else also ..

Posted by on May 17, 2009 in Brain Purge .., Tutorials | Comments Off on Setting timezone in CentOS, RHEL, Fedora