feed-image  ISSN 1836-5930



Receive Your Complimentary Guide to Linux NOW!


A Newbie's Getting Started Guide to Linux

Linux from Scratch - Create Your Own Linux System - Free eBook

The GNU/Linux Advanced Administration

A Complete Beginner's Manual for Ubuntu 10.04 (Lucid Lynx)




Poll

Do you care about your privacy when using a FACEBOOK?
 

linuxconfig.org
is hosted by:



Partner Linux Sites
TuxMachines
DebianAdmin
Monsterb
LinuxBloggers
AdamsInfo
LinuxScrew
FreeSoftwareLinux
All For Linux

Linux administration notes & code snippets
Convert Matroska mkv video to PS3 m2ts container file format

Converting Matroska file format to m2ts for use on PS3 has number of advantages. PS3 is able to play mt2s directly from the USB or m2ts file can be copied directly to PS3 it self. There is also way to transcode matroska mkv format with some media server such as "PS3 Media Server". However the disadvantages are that you need to have yet another PC on every time you want to watch and fast rewind forward does not work properly if you do not have fast network and CPU.

If we want to convert mkv to m2ts and yet avoiding propriety software and use Linux, the easiest way is to use mkv2m2ts.sh shell script created by Brian Kulyk. Using mkv2m2ts.sh script is simple, however installation of all pre-requisites to get the script running may be little bit tricky especially if your current Linux distribution does not include tsMuxeR and media mediainfo tools. In this article I'm using chroot debian-sid environment to get available prerequisites from Debian sid and multimedia repository and compile mediainfo from source code. If you do not have chroot debian-sid installation follow this simple chroot tutorial.

Add debian-sid multimedia repository

First we need to download Debian multimedia keyring and install it with dpkg:

# dpkg -i debian-multimedia-keyring_2008.10.16_all.deb 

Use your favorite text editor and add following line into /etc/apt/source.list file:

deb http://www.debian-multimedia.org sid main non-free

Install prerequisites available from debian repository

# apt-get update
# apt-get install tsmuxer bzip2 aften mkvtoolnix libdca-utils faad vorbis-tools

Compile mediainfo tool

before we can start compilation of mediainfo package we need to download a source code.

Extract, compile and install mediainfo software:

# tar xvjf MediaInfo_CLI_0.7.33_GNU_FromSource.tar.bz2
# cd MediaInfo_CLI_GNU_FromSource
# ./CLI_Compile.sh
# cd MediaInfo/Project/GNU/CLI && make install

Get mkv2m2ts.sh script

# wget http://mediatomb.equateuk.com/scripts/mkv2m2ts/mkv2m2ts.sh
# chmod +x mkv2m2ts.sh

Convert matroska mkv to m2ts format

./mkv2m2ts.sh mkv_matroska_format.mkv
 
Download, install, update, erase rpm packages using yum

yum - basics

yum – Red Hat tool for RPM package management used to download, install update, erase or list info about system packages

/etc/yum.repos.d/ -> list of configured repositories (web or ftp sites) that will be searched to download and install RPM packages

To view which repositories you have enabled:

yum repolist enabled
repo id -> repo name -> status
InstallMedia -> Fedora 8 -> enabled
fedora -> Fedora 8 – x86_64 -> enabled
updates -> Fedora 8 – x86_64 – Updates -> enabled

Working with yum:

yum install <package_name> -> will search, download and install requested package (e.g.: yum install gcc)

yum update -> will search for available updates and install them to your system

yum check-update -> will look for available updates for your system

yum upgrade -> similar to yum update, but tries to upgrade all your obsolete packages

yum remove (or erase) <packge_name> -> will remove previously installed package and its dependencies (e.g.: yum remove gcc)

yum search <package_name> -> search for package descriptions

yum clean packages -> cleans yum cache in /var/cache/yum/…

yum info <package_name> -> displays info about requested package (similar to rpm -qi) (e.g.: yum info gcc)

For complete options see man page

 

 
Time countdown bash script example

This is a simple skeleton of a bash countdown script. The script takes two arguments . Here are some examples of its usage:

  • countdown time to 90 minutes from now:
./bash-countdown.sh -m 90
  • countdown time to 23.3.2036 from now:
./bash-countdown.sh -d "Mar 23 2036"
  • countdown time to 21:06 from now:
./bash-countdown.sh -d 21:06
  • countdown time to 21:06:45 from now:
./bash-countdown.sh -d 21:06:45

Feel free to modify this script according to your needs:

bash-countdown.sh :

#!/bin/bash 
 
if [ "$#" -lt "2" ] ; then 
	echo "Incorrect usage ! Example:" 
	echo './countdown.sh -d  "Jun 10 2011 16:06"' 
	echo 'or' 
	echo './countdown.sh -m  90' 
	exit 1 
fi 
 
now=`date +%s` 
 
if [ "$1" = "-d" ] ; then 
	until=`date -d "$2" +%s` 
	sec_rem=`expr $until - $now` 
	echo "-d" 
	if [ $sec_rem -lt 1 ]; then 
		echo "$2 is already history !" 
	fi 
fi 
 
if [ "$1" = "-m" ] ; then 
	until=`expr 60 \* $2` 
	until=`expr $until + $now` 
	sec_rem=`expr $until - $now` 
	echo "-m" 
	if [ $sec_rem -lt 1 ]; then 
		echo "$2 is already history !" 
	fi 
fi 
 
 
while [ $sec_rem -gt 0 ]; do 
	clear 
	date 
	let sec_rem=$sec_rem-1 
	interval=$sec_rem 
	seconds=`expr $interval % 60` 
	interval=`expr $interval - $seconds` 
	minutes=`expr $interval % 3600 / 60` 
	interval=`expr $interval - $minutes` 
	hours=`expr $interval % 86400 / 3600` 
	interval=`expr $interval - $hours` 
	days=`expr $interval % 604800 / 86400` 
	interval=`expr $interval - $hours` 
	weeks=`expr $interval / 604800` 
	echo "----------------------------" 
	echo "Seconds: " $seconds 
	echo "Minutes: " $minutes 
	echo "Hours:   " $hours 
	echo "Days:    " $days 
	echo "Weeks:   " $weeks 
	sleep 1 
done 

Do not forget to make bash-countdown.sh script executable before execution:

$ chmod +x bash-countdown.sh

Exectute:

./bash-countdown.sh -d 22:34

Output:

Fri Jun 11 20:55:19 EST 2010
----------------------------
Seconds:  40
Minutes:  38
Hours:    1
Days:     0
Weeks:    0
 
Send an email using Telnet

Here are simple steps on how to send an email using telnet. This a great way to test your mail server configuration such as exim, sendmail or postfix without a need for a email client. First telnet to yor mail server:

$ telnet mail.mymailserver.com 25

Use HELO command to tell mail server from which domain you are coming from:

HELO linuxconfig.org

Now we need to state from which address this email will be sent. This is done with MAIL FROM: command:

MAIL FROM: someaddress@linuxconfig.org

Next step is to specify recipient with RCPT TO:

RCPT TO: some@email.add

Now we ca star writing some subject and body. To do that we need to use DATA command. First type DATA followed by Subject: and body. Once done enter . to send email to be queued.

DATA
Subject: Sending an email using telnet

Hello,

Here is my body? Do you like it?

cheers
.

Do not forget "." at the end of the message. To quit type

quit
 
More Articles...
«StartPrev12345678910NextEnd»

Page 1 of 19