Install ffmpeg on Centos 6

Step 1 – Install ATRPMS Repository


rpm --import http://packages.atrpms.net/RPM-GPG-KEY.atrpms
rpm -Uvh http://dl.atrpms.net/el6-x86_64/atrpms/stable/atrpms-repo-6-7.el6.x86_64.rpm

Step 2 – Install FFMpeg from ATRPMS Repository


yum -y --enablerepo=atrpms install ffmpeg

Verify that you have FFMpeg installed:

ffmpeg -version


nJoy ;-)

Recording a session for a user when he / she logs in ssh

 

To start recording each session add this to the users .profile file

DATE=$(date +”%Y%m%d%H%M”)
mkdir /log/$DATE
script -t 2>/log/$DATE/bashlogs.timing -aqf /log/$DATE/bashlogs.script

 

to playback go to

/log/<timestamp>

and run

scriptreplay  bashlogs.timing bashlogs.script 3

where the 3 is the speed up factor.

nJoy;

 

Rebooting a Centos server ignoring CIFS or other broken / hung mount

We had a problem on a server df would hang and we knew that a cifs / samba share died and recovered. Trying unmount / with any parameters -l -f failed.

Experience and google told us we need to reboot. This is a remote server and we know the shutdown hangs on going down so another way to restart was needed.

We needed magic !!

Wouldn’t it be nice if there was a way to ask the kernel to reboot without needing to access the failing drive? Well, there is a way, and it is remarkably simple.

The “magic SysRq key” provides a way to send commands directly to the kernel through the /proc filesystem. It is enabled via a kernel compile time option, CONFIG_MAGIC_SYSRQ, which seems to be standard on most distributions. First you must activate the magic SysRq option:

echo 1 > /proc/sys/kernel/sysrq

When you are ready to reboot the machine simply run the following:

echo b > /proc/sysrq-trigger

This does not attempt to unmount or sync filesystems, so it should only be used when absolutely necessary, but if your drive is already failing then that may not be a concern.

In addition to rebooting the system the sysrq trick can be used to dump memory information to the console, sync all filesystems, remount all filesystems in read-only mode, send SIGTERM or SIGKILL to all processes except init, or power off the machine entirely, among other things.

Also, instead of echoing into /proc/sys/kernel/sysrq each time you can activate the magic SysRq key at system boot time using sysctl, where supported:

echo “kernel.sysrq = 1” >> /etc/sysctl.conf

If you would like to learn more about magic SysRq you can read the sysrq.txt file in the kernel documentation.

nJoy 😉

Querying network card information and status

Great tool for checking ethernet NIC information in linux:

ethtool

In ubuntu you might need to install it like so :

sudo apt-get install ethtool

The tool is easy to use:

 

Use

ifconfig -a 

to list nics

then

 

root@wo1:~# ethtool p4p1
Settings for p4p1:
Supported ports: [ TP ]
           Supported link modes: 10baseT/Half 10baseT/Full
                                            100baseT/Half 100baseT/Full
                                            1000baseT/Full
Supported pause frame use: No
Supports auto-negotiation: Yes
Advertised link modes:            10baseT/Half 10baseT/Full
                                            100baseT/Half 100baseT/Full
                                            1000baseT/Full
Advertised pause frame use: Symmetric
Advertised auto-negotiation: Yes
Speed: 1000Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: g
Current message level: 0x00000007 (7)
                                    drv probe link
Link detected: yes
root@wo1:~#

 

nJoy 😉

Convert DEB to RPM or RPM to DEB Package

You can convert DEB file to RPM package and RPM to DEB package using alien command, if you have a *.rpm file that you want to install on a Debian or Ubuntu.

Convert RPM to DEB

Install alien command on Ubuntu as mentioned here:

# sudo apt-get install alien

Now, use alien command to convert rpm to deb file,

# alien clamav-0.92.1-1.el5.rf.i386.rpm

clamav-0.92.1-1.el5.rf.i386.deb generated

Finally, Install deb packages using the dpkg command,

# dpkg -i clamav-0.92.1-1.el5.rf.i386.deb

Where,
-i = install a package

Convert DEB to RPM

Use alient -r option to convert a deb file to rpm file.

# alien -r clamav-0.92.1-1.el5.rf.i386.deb

clamav-0.92.1-1.el5.rf.i386.rpm generated

Once you generate the rpm file, you can install it on Red Hat, Fedora or CentOS.
Finally install rpm,

# rpm -ivh clamav-0.92.1-1.el5.rf.i386.rpm

Where,
-i = Install RPM
-v = Install in verbose Mode
-h = Print  50  hash  marks  as the package archive is unpacked

nJoy 😉

 

Restarting shpinx for kaltura

Common problem with kaltura..

Common solution …

pkill searchd 
/opt/kaltura/bin/sphinx/searchd -c /opt/kaltura/app/configurations/sphinx/kaltura.conf

nJoy 😉

One Liner Email from bash

Simple:

echo “This will go into the body of the mail.” | mail -s “Hello world” you@youremailid.com

nJoy 😉

 

Automagically maintain a file system with autofs

Pending more detail

yum install -y autofs

/etc/autofs.master contains used protocols

/- /etc/autofs.nfs

/etc/autofs.nfs

/mnt/mountpoint -fstype=nfs,rw,soft,intr,rsize=8192,wsize=8192 hostname_or_IP:/mnt/exported_folder

To find out what is exported on a given machine use

showmount -e

nJoy 😉