Installing the imon LCD in Linux

On June 9, 2008, in mythtv, by Michael

Before I get into another howto about my experiences in MythTV, I have to say I created the following instructions mostly for myself, because everytime I redo my MythTV box, it takes me forever to get the damn LCD working. Now finally I have written it down. If it helps someone else, even better.

The following instructions describe how to successfully setup the imon vfd for use with MythTV on a Fedora Core 5 system running at least a 2.6.16 kernel and above. These instructions are modified where needed from the original site venky.ws. Also these instuctions do not activate the IR receiver that comes included in the imon vfd in the LC10M enclosure, simply just the lcd display.

Stand Alone Driver for imon vfd

Prerequisites:
You must have the kernel source or headers in /usr/src/linux that exactly match your running kernel. The installation instructions below assume you are running a 2.6.16 kernel or above.

Installation:

Download the stand alone driver here

# tar xvzf imon_vfd.tgz
# cd imon

Remove the following lines from the imon_vfd.c file:

line 122 owner = THIS_MODULE 
line 147 owner = THIS_MODULE 
line 162 mode = DEVFS_MODE

Check for devfs_fs_kernel.h

# ls /usr/src/kernels/`uname -r`-`uname -m`/include/linux/devfs_fs_kernel.h
No such file or directory

If you do not have the devfs_fs_kernel.h file, just create a blank file.

# touch /usr/src/kernels/`uname -r`-`uname -m`/include/linux/devfs_fs_kernel.h

Before we run the make command I like to modify the Makefile and remove the `name -r` bit. Replace it with the real name of your kernel.

# make -C /usr/src/linux SUBDIRS=$PWD
# modules
# make install
# depmod -a
# modprobe imon_vfd

Now check to make sure the lcd device has been created.

# ls /dev/lcd0
/dev/lcd0

LCDproc 0.4.5 for imon

This is the most recent stable version of LCDproc together with the iMON patch.
Prerequisites:
You must have the kernel source or headers in /usr/src/linux that exactly match your running kernel.
Make sure you have the autoconf and automake packages installed.
Make sure you have ncurses-devel installed.
Install the standalone iMON VFD driver.

Installation:

Download LCDproc from here

# tar xvzf lcdproc-0.4.5-imon.tgz 
# cd lcdproc-0.4.5-imon
# aclocal; autoheader; autoconf; automake -a 
# ./configure
# make
# make install (as root) 
# cp LCDd.conf /etc

Now add an entry for the imon_vfd so it will be loaded at boot time.

# echo "/sbin/modprobe imon_vfd" >> /etc/sysconfig/modules/lirc.modules

Finally add LCDd to the rc.local file so that it is started at boot time.

# echo "/usr/local/sbin/LCDd &" >> /etc/rc.local

Lastly be sure to enable the option for LCD output in the MythTV options menu.

Tagged with:  

Mounting a Samba Share on Boot

On June 9, 2008, in posts, by Michael

Now that my file server project is out of the way, I needed a way to mount its massive share on my linux servers. I also wanted to keep some home directories on the filer, however when I mounted it, the directory was owned by root and the user wasn’t allowed to write files to it.

To get around this, I started looking into various ways of controlling the permissions. I also wanted this to be mounted during boot, but first I needed to make a mount point.

mkdir /filer

Now I started playing with various methods to mount the share. The best method I was able to find was as follows.

mount //server/share /filer -t cifs -o gid=99,uid=99,dir_mode=0777,file_mode=0777,rw

In the above example, you can see that the share is mounted to /filer using the group id of 99 and user id of 99. On my system, these id’s are owned by the nobody user. Which is basically just a guest account. This will allow everyone to write to the mounted share.

The next step is to have the share mounted during boot up. So I needed to add an entry to the /etc/fstab file. Below is the entry I placed in my fstab file.

//(Servers IP)/filer /filer cifs gid=99,uid=99,dir_mode=0777,file_mode=0777,rw 0 0

Now whenever the server is restarted I can be assured that the share will be mounted with the permissions I wanted. After a quick test reboot I can now see that my share is mounted, and the permissions I wanted are set aswell.

root@myserver ~]# ls -ld /filer
drwxrwxrwx  1 nobody nobody 0 Sep 16 23:58 /filer
Tagged with:  

Simple Daily Backup Solution

On June 9, 2008, in posts, by Michael

As promised, here is the backup script I now have in place to take care of all my backup needs. I can’t take all of the credit, as the original idea came from this site. I just modified it to make it more robust and to better fit my needs.

To use, place all of the contents into a file anywhere on your system. I called mine, daily_backup.sh and placed it in the directory /root/scripts/. Once the script is in place, change the permissions to make it executable.

chmod 754 daily_backup.sh

Now modify the script changing the options and directories to suite your system and environment. To create the crontab entry, as root run the following.

crontab -e

Then add the following line, which will execute our script everynight at 3:01AM.

1 3 * * * /root/scripts/daily_backup.sh

Below is the script as it is setup on my system. Feel free to modify it to better suite your needs. As aways comments are welcome and appreciated.

#!/bin/bash
#
# Daily backup
#
 
########################################
## Backup location options
 
# Location of remote backups
BACKUPDIR="/filer/Backup";
# Set to no if not backing up to a remote mount
VERIFYMOUNT="yes";
# Local mount point of remote server
MOUNTNAME="/filer";
# Database username
DBUSER="sampleuser";
# Database password
DBPASS="samplepass";
# Day to run full backup
DOWFB="Sun";
 
########################################
## Backup data options
 
# Space separated directories to backup
DATADIRS="/var/www/html /etc";
# Space separated MySQL databases to backup
DBNAMES=( mysql mydb1 mydb2 );
 
########################################
########## End User Options ############
########################################
 
 
########################################
## Variables and checks used by script
 
LIST="/tmp/backlist_$$.txt";
set $(date)
 
if [ "$VERIFYMOUNT" == "yes" ]; then
  RESULT=`mount | grep $MOUNTNAME`;
 
  if [ ! "$RESULT" ]; then
    exit 1;
  fi
fi
 
########################################
## Create backup of data directories
 
if test "$1" = "$DOWFB" ; then
 
  #######################################
  ## Weekly full backup
 
  if [ ! -d "$BACKUPDIR/data" ]; then
    mkdir -p $BACKUPDIR/data
  fi
 
  tar cfz "$BACKUPDIR/data/data_full_$6-$2-$3.tgz" $DATADIRS
  rm -f $BACKUPDIR/data/data_diff*
 
else
 
  ########################################
  ## Daily incremental backup
 
  if [ ! -d "$BACKUPDIR/data" ]; then
    mkdir -p $BACKUPDIR/data
  fi
 
  find $DATADIRS -depth -type f ( -ctime -1 -o -mtime -1 ) -print > $LIST
  tar cfzT "$BACKUPDIR/data/data_diff_$6-$2-$3.tgz" "$LIST"
  rm -f "$LIST"
 
fi
 
########################################
## Create sql dump of databases
 
if [ ! -d "$BACKUPDIR/database" ]; then
  mkdir -p $BACKUPDIR/database
fi
 
for db in ${DBNAMES[@]}
do
  mysqldump -u $DBUSER --password=$DBPASS --opt $db > "$BACKUPDIR/database/$db-$6-$2-$3.sql"
  gzip "$BACKUPDIR/database/$db-$6-$2-$3.sql"
done
 
exit 0
Tagged with: