If you want to see all unique lines within a file, use the uniq command within Linux/Unix. To do so, just execute uniq against a file.
#uniq /var/log/messages
Or, less elegantly...
#cat /var/log/messages | uniq
This will also work with standard input.
This is a repository of all of my Linux/Unix writings as well as useful tips and tricks for systems administration, engineering, and programming.
Tuesday, February 10, 2009
Friday, January 16, 2009
Quick and dirty openLDAP replication
This is a cursory view of how to install and configure a master and slave openLDAP server pair. Unless specified, follow each step on both the master and the slave servers. The only real difference between the servers is the presence of a slurpd configuration on the master and the unique slapd configuration on both servers. In the end, you will have a syncing pair which will replicate changes from the master server to the slave server every three seconds.
A. Install OS and LDAP
1.Install your OS. I am assuming Linux, specifically RHEL or Fedora Core, but openLDAP will run on a variety of systems and these instructions can be adapted to your specific flavor.
2.On both the master and the slave, install openldap, php, httpd and the dependencies with the command (assuming RHEL or Fedora Core):
# yum -t -y install openldap-clients openldap-servers openldap php-ldap nss_ldap httpd php
B. Install and configure phpLDAPadmin (optional)
3.Install phpLDAPadmin from this website: http://phpldapadmin.sourceforge.net/wiki/index.php/Main_Page
4.Untar the download, and then copy the file phpldapadmin-<version>/config/config.php.example to phpldapadmin-/config/config.php
5.Move the phpldapadmin-<version> to /var/www/html/phpldapadmin
6.Restart httpd with the command
#chkconfig httpd on
#service httpd restart
C. Configure and test LDAP
7.Make sure that the master server's hostname is pingable from the slave and vice versa. If not, add the entries to /etc/hosts and restart networking with the command:
#service network restart
8.Copy /etc/openldap/ldap.conf to /etc/openldap/ldap.conf.orig
9.Copy /etc/openldap/sldapd.conf to /etc/openldap/slapd.conf.orig
10.Copy /etc/openldap/DB_CONFIG.example to /var/lib/ldap/DB_CONFIG
11.Copy the configuration files to the respective servers. These are located at the bottom of this document. Make sure to copy the correct ldap.conf and slapd.conf to their respective servers.
12.Import the base dn from the base.ldif file (included later in this document)
#slapadd < /etc/openldap/base.ldif
13.Start the LDAP service
# chkconfig ldap on
# service ldap start
14.Point to http://hostname/ or http://hostname/phpldapadmin If you get a “php memory too low” error, change the memory limit to something meaningful in /etc/php.ini
memory_limit = 128M ; For example
15.The login for the server is cn=root,dc=example,dc=com and the password needs to be set with slappasswd. Use slappasswd and change the hash in the /etc/openldap/slapd.conf file.
# slappasswd
New password:
Re-enter new password:
{SSHA}At/pOvtko2KXcKfM7t0o/OPedJrpXQM0
Now enter the line with the hashed password in the file /etc/openldap/slapd.conf as shown:
rootpw {SSHA}At/pOvtko2KXcKfM7t0o/OPedJrpXQM0
16.From the phpLDAPadmin GUI or using #slapadd similar to before, import the ldif file from a backup or existing server to the master server. If you have not created or do not have a backup of the ldif file of the old directory server, the other option is to copy the /var/lib/ldap directory over to the new server. If starting from scratch, this is a mute point.
17.If syncing is working, it will be replicated on the slave server. If not, the file /var/lib/ldap/replica/openldap-master-replog on the master server will tell you why.
18.For testing the syncing and replication of the master and slave servers, add a new entry to the master server and see if the entry appears on the slave server. For testing the subordination of the slave server, create an entry on the slave server and watch as it is not replicated on the master server.
/etc/openldap/base.ldif (For both servers)
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
dc: example
o: Example
/etc/openldap/ldap.conf (For master server)
URI ldap://127.0.0.1/
BASE dc=example,dc=com
TLS_CACERTDIR /etc/openldap/cacerts
/etc/openldap/slapd.conf (For master server)
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
allow bind_v2
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
#Note that this should be changed based upon the hostname or user for greater security
access to *
by * read
by anonymous auth
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
# rootdn can always read and write EVERYTHING!
database bdb
suffix "dc=example,dc=com"
rootdn "cn=root,dc=example,dc=com"
rootpw {SSHA}/mYjTZhwSR1hIGKt6qD0oBpHdRjeHSGh
directory /var/lib/ldap
index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub
# Replicas of this database
replogfile /var/lib/ldap/openldap-master-replog
replica host="slave:389"
suffix="dc=example,dc=com"
binddn="cn=root,dc=example,dc=com"
credentials=changeme
bindmethod=simple
/etc/openldap/ldap.conf (For slave server)
URI ldap://127.0.0.1
BASE dc=example,dc=com
TLS_CACERTDIR /etc/openldap/cacerts
updatedn "cn=root,dc=example,dc=com"
updateref ldap://master
rootdn "cn=root,dc=example,dc=com"
rootpw {SSHA}nlb8tJHDUJCMqQMBMyMIIu26VF1ViVEu
/etc/openldap/slapd.conf (For slave server)
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
allow bind_v2
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
# Note that you should change this based upon the hostname of the master server.
access to *
by * write
by anonymous auth
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
# rootdn can always read and write EVERYTHING!
database bdb
suffix "dc=example,dc=com"
rootdn "cn=root,dc=example,dc=com"
rootpw {SSHA}/mYjTZhwsR1hIGKt6qD0oBpHdRjeHSGh
updatedn "cn=root,dc=example,dc=com"
updateref ldap://master
directory /var/lib/ldap
index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub
TLSCertificateFile /etc/openldap/ldap.cert
TLSCertificateKeyFile /etc/openldap/ldap.key
A. Install OS and LDAP
1.Install your OS. I am assuming Linux, specifically RHEL or Fedora Core, but openLDAP will run on a variety of systems and these instructions can be adapted to your specific flavor.
2.On both the master and the slave, install openldap, php, httpd and the dependencies with the command (assuming RHEL or Fedora Core):
# yum -t -y install openldap-clients openldap-servers openldap php-ldap nss_ldap httpd php
B. Install and configure phpLDAPadmin (optional)
3.Install phpLDAPadmin from this website: http://phpldapadmin.sourceforge.net/wiki/index.php/Main_Page
4.Untar the download, and then copy the file phpldapadmin-<version>/config/config.php.example to phpldapadmin-/config/config.php
5.Move the phpldapadmin-<version> to /var/www/html/phpldapadmin
6.Restart httpd with the command
#chkconfig httpd on
#service httpd restart
C. Configure and test LDAP
7.Make sure that the master server's hostname is pingable from the slave and vice versa. If not, add the entries to /etc/hosts and restart networking with the command:
#service network restart
8.Copy /etc/openldap/ldap.conf to /etc/openldap/ldap.conf.orig
9.Copy /etc/openldap/sldapd.conf to /etc/openldap/slapd.conf.orig
10.Copy /etc/openldap/DB_CONFIG.example to /var/lib/ldap/DB_CONFIG
11.Copy the configuration files to the respective servers. These are located at the bottom of this document. Make sure to copy the correct ldap.conf and slapd.conf to their respective servers.
12.Import the base dn from the base.ldif file (included later in this document)
#slapadd < /etc/openldap/base.ldif
13.Start the LDAP service
# chkconfig ldap on
# service ldap start
14.Point to http://hostname/ or http://hostname/phpldapadmin If you get a “php memory too low” error, change the memory limit to something meaningful in /etc/php.ini
memory_limit = 128M ; For example
15.The login for the server is cn=root,dc=example,dc=com and the password needs to be set with slappasswd. Use slappasswd and change the hash in the /etc/openldap/slapd.conf file.
# slappasswd
New password:
Re-enter new password:
{SSHA}At/pOvtko2KXcKfM7t0o/OPedJrpXQM0
Now enter the line with the hashed password in the file /etc/openldap/slapd.conf as shown:
rootpw {SSHA}At/pOvtko2KXcKfM7t0o/OPedJrpXQM0
16.From the phpLDAPadmin GUI or using #slapadd similar to before, import the ldif file from a backup or existing server to the master server. If you have not created or do not have a backup of the ldif file of the old directory server, the other option is to copy the /var/lib/ldap directory over to the new server. If starting from scratch, this is a mute point.
17.If syncing is working, it will be replicated on the slave server. If not, the file /var/lib/ldap/replica/openldap-master-replog on the master server will tell you why.
18.For testing the syncing and replication of the master and slave servers, add a new entry to the master server and see if the entry appears on the slave server. For testing the subordination of the slave server, create an entry on the slave server and watch as it is not replicated on the master server.
/etc/openldap/base.ldif (For both servers)
dn: dc=example,dc=com
objectClass: top
objectClass: dcObject
objectClass: organization
dc: example
o: Example
/etc/openldap/ldap.conf (For master server)
URI ldap://127.0.0.1/
BASE dc=example,dc=com
TLS_CACERTDIR /etc/openldap/cacerts
/etc/openldap/slapd.conf (For master server)
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
allow bind_v2
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
#Note that this should be changed based upon the hostname or user for greater security
access to *
by * read
by anonymous auth
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
# rootdn can always read and write EVERYTHING!
database bdb
suffix "dc=example,dc=com"
rootdn "cn=root,dc=example,dc=com"
rootpw {SSHA}/mYjTZhwSR1hIGKt6qD0oBpHdRjeHSGh
directory /var/lib/ldap
index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub
# Replicas of this database
replogfile /var/lib/ldap/openldap-master-replog
replica host="slave:389"
suffix="dc=example,dc=com"
binddn="cn=root,dc=example,dc=com"
credentials=changeme
bindmethod=simple
/etc/openldap/ldap.conf (For slave server)
URI ldap://127.0.0.1
BASE dc=example,dc=com
TLS_CACERTDIR /etc/openldap/cacerts
updatedn "cn=root,dc=example,dc=com"
updateref ldap://master
rootdn "cn=root,dc=example,dc=com"
rootpw {SSHA}nlb8tJHDUJCMqQMBMyMIIu26VF1ViVEu
/etc/openldap/slapd.conf (For slave server)
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
allow bind_v2
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
# Note that you should change this based upon the hostname of the master server.
access to *
by * write
by anonymous auth
# if no access controls are present, the default policy
# allows anyone and everyone to read anything but restricts
# updates to rootdn. (e.g., "access to * by * read")
# rootdn can always read and write EVERYTHING!
database bdb
suffix "dc=example,dc=com"
rootdn "cn=root,dc=example,dc=com"
rootpw {SSHA}/mYjTZhwsR1hIGKt6qD0oBpHdRjeHSGh
updatedn "cn=root,dc=example,dc=com"
updateref ldap://master
directory /var/lib/ldap
index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub
TLSCertificateFile /etc/openldap/ldap.cert
TLSCertificateKeyFile /etc/openldap/ldap.key
Labels:
ldap,
Linux,
openldap,
phpldapadmin,
Red Hat,
replication,
slapd,
slurpd
Wednesday, January 7, 2009
DNS lookups
To find a hostname when you know the IP address:
nmblookup -A <ip_address>
eg. nmblookup -A 192.168.0.148
or
host <ip_address>
eg. host 192.168.0.148
To find an IP address when you know the hostname, try the following ways:
whois www.google.com
dig www.google.com
nslookup www.google.com
nmblookup -A <ip_address>
eg. nmblookup -A 192.168.0.148
or
host <ip_address>
eg. host 192.168.0.148
To find an IP address when you know the hostname, try the following ways:
whois www.google.com
dig www.google.com
nslookup www.google.com
Friday, January 2, 2009
Install and configure NTP
NTP is great at keeping your Linux server or desktop's time synced. Not having the time synced can potentially cause issues with backup software, applications and some web applications. Here is a sample script to install and configure NTP on Linux. This was created for Red Hat, but it should work with other versions of Linux with few modifications (like the installation of the init scripts).
#NTP configuration script.
date
cat /var/lib/ntp/drift
chkconfig ntpd --list
service ntpd stop
ntpdate -u 0.rhel.pool.ntp.org
ntpdate -u 1.rhel.pool.ntp.org
ntpdate -u 2.rhel.pool.ntp.org
chkconfig ntpd on
cat /etc/ntp.conf | grep server
vi /etc/ntp.conf
#Based upon the output of those commands, add (or delete) the following lines in /etc/ntp.conf
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
#Now save and test
service ntpd start
sleep 4
ntpq -p
cat /var/lib/ntp/drift
date
#NTP configuration script.
date
cat /var/lib/ntp/drift
chkconfig ntpd --list
service ntpd stop
ntpdate -u 0.rhel.pool.ntp.org
ntpdate -u 1.rhel.pool.ntp.org
ntpdate -u 2.rhel.pool.ntp.org
chkconfig ntpd on
cat /etc/ntp.conf | grep server
vi /etc/ntp.conf
#Based upon the output of those commands, add (or delete) the following lines in /etc/ntp.conf
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
#Now save and test
service ntpd start
sleep 4
ntpq -p
cat /var/lib/ntp/drift
date
Friday, December 19, 2008
Friday, December 5, 2008
Rename files which match specific criteria
This renames all files within the current working directory from .exe to .exeold. This is useful if you are trying to rename any file extension from one to another.
for file in *.exe ; do mv $file `echo $file | sed 's/\(.*\.\)exe/\1exeold/'` ; done
for file in *.exe ; do mv $file `echo $file | sed 's/\(.*\.\)exe/\1exeold/'` ; done
Wednesday, November 12, 2008
Simple bash for loop
for kernelrpm in kernel-smp-2.6.9-5.EL kernel-smp-2.6.9-34.EL kernel-smp-2.6.9-67.0.1.EL kernel-utils-2.4-14.1.117
do rpm -e $kernelrpm
done
do rpm -e $kernelrpm
done
Thursday, October 9, 2008
Boot FreeBSD with Grub
If you have installed FreeBSD (or any operating system) and a partition and then later installed Linux (or any operating system with Grub) on another partition and can't get the latter to boot the former, add this line to /boot/grub/menu.lst
# For booting FreeBSDIn this case, the partition was /dev/sda2 which contained FreeBSD. Modify it for your needs.
title FreeBSD 7.0
root (hd0,1)
chainloader +1
Wednesday, October 8, 2008
Coraid documentation
I was able to do quite a bit of technical writing with Coraid. It is useful for those of you using AoE technology. I wrote all of the quickstart documentation here:
http://www.coraid.com/RESOURCES/Quickstart-Documentation
Also, I wrote the driver installation guides here:
http://www.coraid.com/SUPPORT/AoE-Drivers
http://www.coraid.com/RESOURCES/Quickstart-Documentation
Also, I wrote the driver installation guides here:
http://www.coraid.com/SUPPORT/AoE-Drivers
A Tag Cloud that works with Blogger
I have spent a great deal of time trying to find a Tag Cloud generator that works with Google Blogger. Finally, I found one.
http://www.compender.com/2007/12/simple-tag-cloud.html
http://www.compender.com/2007/12/simple-tag-cloud.html
LVM snapshots
Here is a script to create LVM snapshots in Linux. It is a skeleton only provided for your modification and my reference, but I am using AoE storage as my PV.
#create PV
pvcreate /dev/etherd/e1.0
#create VG
vgcreate cascade /dev/etherd/e1.0
#create LV
lvcreate cascade -n original -L 500G
#make XFS filesystem
mkfs.xfs /dev/cascade/original
#mount (and use) LV
mount /dev/cascade/original /mnt
#freeze filesystem (will hang processes that are using IO on /mnt)
xfs_freeze -f /mnt
#create snapshot of original (works best if it is the same size)
lvcreate -s /dev/cascade/original -n backup -L 500G
#mount snapshot
mount -o nouuid,ro /dev/cascade/backup /mnt2
#backup directory with rsync or backup utility
#unmount LV
umount /mnt2
#remove snapshot
lvremove /dev/cascade/backup
#additional information is found here: http://arstechnica.com/articles/columns/linux/linux-20041013.ars and here: http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html
#create PV
pvcreate /dev/etherd/e1.0
#create VG
vgcreate cascade /dev/etherd/e1.0
#create LV
lvcreate cascade -n original -L 500G
#make XFS filesystem
mkfs.xfs /dev/cascade/original
#mount (and use) LV
mount /dev/cascade/original /mnt
#freeze filesystem (will hang processes that are using IO on /mnt)
xfs_freeze -f /mnt
#create snapshot of original (works best if it is the same size)
lvcreate -s /dev/cascade/original -n backup -L 500G
#mount snapshot
mount -o nouuid,ro /dev/cascade/backup /mnt2
#backup directory with rsync or backup utility
#unmount LV
umount /mnt2
#remove snapshot
lvremove /dev/cascade/backup
#additional information is found here: http://arstechnica.com/articles/columns/linux/linux-20041013.ars and here: http://tldp.org/HOWTO/LVM-HOWTO/snapshots_backup.html
Wednesday, October 1, 2008
List largest (or smallest) files
If you want to find the largest files in a directory which are consuming precious space, you can use the following command:
openSuSEServer:~ # du -kh /var | sort -n | tail
then, to sort the smallest files, use the inverse command:
openSuSEServer:~ # du -kh /var | sort -n | head
openSuSEServer:~ # du -kh /var | sort -n | tail
then, to sort the smallest files, use the inverse command:
openSuSEServer:~ # du -kh /var | sort -n | head
Wednesday, August 13, 2008
Adding a subject to an e-mail link
Usually, an e-mail link would look like this:
<a href="mailto:sales@coraid.com">E-mail sales </a>
But to add a subject line to the e-mail when someone clicks the link and sends an e-mail is done with the one of the two following examples:
<a href="mailto:sales@coraid.com?subject=New%20sales%20inquiry">E-mail sales</a>
or
<a href="mailto:sales@coraid.com" title="New sales inquiry">E-mail sales</a>
The first one works every time that I have used it, but the second one is an HTML compliant way of doing the same thing.
<a href="mailto:sales@coraid.com">E-mail sales </a>
But to add a subject line to the e-mail when someone clicks the link and sends an e-mail is done with the one of the two following examples:
<a href="mailto:sales@coraid.com?subject=New%20sales%20inquiry">E-mail sales</a>
or
<a href="mailto:sales@coraid.com" title="New sales inquiry">E-mail sales</a>
The first one works every time that I have used it, but the second one is an HTML compliant way of doing the same thing.
Tuesday, August 12, 2008
Coraid blogging
I am now working for Coraid as a systems engineer. I will be blogging professionally at Coraid's blog, and also will be responsible for much of the company's new documentation, which has kept me very busy so far. I will continue to blog here when I find interesting things to blog about.
Friday, June 27, 2008
Dates within crontab
If you want to add dates to backups or logs, like mythtvDB27062008.sql within crontab, do the following:
0 0 * * * /usr/bin/mysqldump -u mythtv -pPassword mythconverg > /mythtv/recordings/mythtvDB`date +%d%m%Y`.sql
The key is the backquotes around the `date +%d%m%Y` command. This will backup a MythTV MySQL database to a file like this: /mythtv/recordings/mythtvDB27062008.sql every night at midnight.
0 0 * * * /usr/bin/mysqldump -u mythtv -pPassword mythconverg > /mythtv/recordings/mythtvDB`date +%d%m%Y`.sql
The key is the backquotes around the `date +%d%m%Y` command. This will backup a MythTV MySQL database to a file like this: /mythtv/recordings/mythtvDB27062008.sql every night at midnight.
Friday, June 13, 2008
Change hostname
To change the name of the computer's name (hostname) do the following:
#echo <hostname> > /etc/HOSTNAME
Example:
#echo earth > /etc/HOSTNAME
Tuesday, May 27, 2008
Mount ISO images as physical devices
Here is a great how-to with mounting ISO images as though they were a physical device like a CD-ROM or DVD drive:
http://www.cyberciti.biz/tips/how-to-mount-iso-image-under-linux.html
http://www.cyberciti.biz/tips/how-to-mount-iso-image-under-linux.html
Tag cloud generation
Of the many that I have tried, this website is the best for tag cloud generation:
http://www.tagcloud-generator.com/index.php
http://www.tagcloud-generator.com/index.php
Execute any custom command on bootup (Ubuntu, Debian)
This command is for anything that you would like to execute after the system has been started and all of the scripts in /etc/init.d/ have been run. If you want them to execute afterwards, put it in
/etc/rc.local
This is rather useful for network mounts, changes to hardware configuration, or custom programs that need to be started at boot. Make sure to make the file executable through the command: $sudo chmod +x /etc/rc.local
/etc/rc.local
This is rather useful for network mounts, changes to hardware configuration, or custom programs that need to be started at boot. Make sure to make the file executable through the command: $sudo chmod +x /etc/rc.local
Mount a cdrom from the command line
To mount a cdrom (or DVD) from the command line, do the following:
#mount -t iso9660 -o ro <device> <mountedDirectory>
Example:
# mount -t iso9660 -o ro /dev/cdrom /media/cdrom
Note: make sure that /media/cdrom exists.
#mount -t iso9660 -o ro <device> <mountedDirectory>
Example:
# mount -t iso9660 -o ro /dev/cdrom /media/cdrom
Note: make sure that /media/cdrom exists.
Monday, May 26, 2008
Configure a wireless connection from the command line
Here is how to configure a wireless network interface from the command line in Ubuntu.
http://www.stoltenow.com/archives/2006/12/ubuntu_configur.html
http://www.stoltenow.com/archives/2006/12/ubuntu_configur.html
Sunday, May 4, 2008
Copying DVDs from the command line
Would you like to store a backup of your DVD collection to disk? Here is how, using vobcopy, a lossless copy:
#vobcopy [--large-file] [-verbose] [-input-dir DVD_DEVICE]
Example:
#vobcopy -l -v -i /dev/dvd
#vobcopy [--large-file] [-verbose] [-input-dir DVD_DEVICE]
Example:
#vobcopy -l -v -i /dev/dvd
Thursday, April 17, 2008
Execute any custom command on bootup (SuSE or Red Hat)
This command is for anything that you would like to execute after the system has been started and all of the scripts in /etc/init.d/ have been run. If you want to execute these commands before any of these scripts, but the commands in the new file:
/etc/init.d/before.local
If you want them to execute afterwards, put it in
/etc/init.d/after.local
This is rather useful for network mounts, changes to hardware configuration, or custom programs that need to be started at boot. Make sure to make the file executable through the command: chmod +x /etc/init.d/after.local
The other option is to edit the /etc/rc.d/rc.local and do that same there.
/etc/init.d/before.local
If you want them to execute afterwards, put it in
/etc/init.d/after.local
This is rather useful for network mounts, changes to hardware configuration, or custom programs that need to be started at boot. Make sure to make the file executable through the command: chmod +x /etc/init.d/after.local
The other option is to edit the /etc/rc.d/rc.local and do that same there.
Thursday, April 3, 2008
Monday, March 24, 2008
Mythweb at its best

Mythweb, a component of MythTV, allows you to stream your own recorded videos, shows or movies from the Internet in a YouTube-like interface. Here is an example. One more reason MythTV beats the socks off TiVO.
Saturday, March 22, 2008
Why Webmin is the best tool for Systems Administrators
In the SysAdmin world, Webmin is the best invention next to sliced bread. It is a compete, web-based administration interface for dozens of different systems. Not only does it support a plethora of operating systems, but it is much better than Red Hat's system-config-* and almost as good as Novell's Yast. It knocks the socks off any other administration tool that I have seen. You can download the package for your distro at Webmin's Website I guess you can call me a Webmin fanboy.
Labels:
administration,
Novell,
Red Hat,
system-config,
webmin,
Yast
Lexmark Z645 Printer on Ubuntu Linux
This post, is how you can get a Lexmark Z645 Printer to work within Ubuntu 7.04, 7.10, 8.04 and later. It is most useful. http://ubuntuforums.org/archive/index.php/t-616097.html
Tuesday, March 11, 2008
Writing ISO files from the commandline
Maybe you want to rip a data CD or DVD into an ISO formatted file. Here is how to do it from the command line:
$wodim -v dev=<device> [speed] <trackName.iso>
For example:
$wodim -v dev=/dev/scd0 speed=4 puppy-3.01-seamonkey.iso
$wodim -v dev=<device> [speed] <trackName.iso>
For example:
$wodim -v dev=/dev/scd0 speed=4 puppy-3.01-seamonkey.iso
Backup or restore a MySQL database
They say that a system administrator is only as good as his last backup. If you need to backup or restore a MySQL database, you can execute these commands:
Backup the database:
$mysqldump -u <adminuser> -p <password> <databasename> > <databasebackupfile.sql>
For example:
$mysqldump -u root -p myPass mythconverg > mythdatabasebackup.sql
Restore the database:
$mysql -u <adminuser> -p <password> <databasename> < <databasebackupfile.sql>
For example:
$mysql -u root -p myPass mythconverg < mythdatabasebackup.sql
Backup the database:
$mysqldump -u <adminuser> -p <password> <databasename> > <databasebackupfile.sql>
For example:
$mysqldump -u root -p myPass mythconverg > mythdatabasebackup.sql
Restore the database:
$mysql -u <adminuser> -p <password> <databasename> < <databasebackupfile.sql>
For example:
$mysql -u root -p myPass mythconverg < mythdatabasebackup.sql
Repair a MySQL database
Sometimes you can do something to your MySQL database which causes corruption. You can fix this with the following command:
$mysqlcheck <database> -u <adminuser> -p <password> --auto-repair
For example:
$mysqlcheck mythconverg -u root -p myPass --auto-repair
This will automatically repair any corruption found within the database schema.
$mysqlcheck <database> -u <adminuser> -p <password> --auto-repair
For example:
$mysqlcheck mythconverg -u root -p myPass --auto-repair
This will automatically repair any corruption found within the database schema.
Align and clean printer heads for a Lexmark printer
If you have a Lexmark printer within Linux, it may be difficult to align or clean the printer heads as these utilities are nonexistent within cups. I have a Lexmark z645 printer. The workaround is to use the lpr utilities to get the job done. With some modification, this should work for most printers, not just Lexmark ones.
To align printer heads:
#lpr -P <printernamewithincups> -o raw <pathtoalignutility.out>
For example:
#lpr -P Lexmark_640_Series -o raw /usr/local/z600llpddk/utility/lxbcalgn.out
To clean printer heads:
#lpr -P <printernamewithincups> -o raw <pathtocleanutility.out>
For example:
#lpr -P Lexmark_640_Series -o raw /usr/local/z600llpddk/utility/lxbccln.out
The -o raw allows the job to be performed without going through MIME filters. Note that the paths may be different depending on your printer's driver. Use the command:
#find / -iname *.out to locate the correct path for the align and clean utility.
To align printer heads:
#lpr -P <printernamewithincups> -o raw <pathtoalignutility.out>
For example:
#lpr -P Lexmark_640_Series -o raw /usr/local/z600llpddk/utility/lxbcalgn.out
To clean printer heads:
#lpr -P <printernamewithincups> -o raw <pathtocleanutility.out>
For example:
#lpr -P Lexmark_640_Series -o raw /usr/local/z600llpddk/utility/lxbccln.out
The -o raw allows the job to be performed without going through MIME filters. Note that the paths may be different depending on your printer's driver. Use the command:
#find / -iname *.out to locate the correct path for the align and clean utility.
Labels:
align,
clean,
cups,
find,
Lexmark Z645,
lpr,
print heads
Past writings for the BYU-I Linux/Unix Society
I have been the BYU-Idaho Linux/Unix Society President for four semesters. During that time, I have had the opportunity to present articles on various themes. Here are links to those documents:
How to install Linux within VMWare (PDF)
Gaming in Linux (PDF)
Multimedia within Linux (PDF)
Build your own TiVo with MythTV (PDF)
The society's website is located here.
How to install Linux within VMWare (PDF)
Gaming in Linux (PDF)
Multimedia within Linux (PDF)
Build your own TiVo with MythTV (PDF)
The society's website is located here.
Why Masters of the Universe?

When I was younger, my brother and I were enthralled with He-Man and the Masters of the Universe cartoon show. We enjoyed playing with the action figures and imagining we were He-Man. This blog is a throwback to the idea of overwhelming power over evil. In this case, through using Linux.
Subscribe to:
Posts (Atom)