Thursday, May 23, 2013

How to take multiple screenshots to an image (tile, mosaic)


To make multiple screenshots and place them into a single image file (creating tiles), you can use FFmpeg's tile video filter, like this:
ffmpeg -ss 00:00:10 -i movie.avi -frames 1 -vf 'select=not(mod(n\,1000)),scale=320:240,tile=2x3' out.png
That will seek 10 seconds into the movie, select every 1000th frame, scale it to 320x240 pixels and create 2x3 tiles in the output image out.png, which will look like this:


Friday, April 19, 2013

HowTo Use rsync For Transferring Files Under Linux or UNIX


How do you install and use rsync to synchronize files and directories from one location (or one server) to another location? - A common question asked by new sys admin.

rsync is a free software computer program for Unix and Linux like systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction.

So what is unique about the rsync command?

It can perform differential uploads and downloads (synchronization) of files across the network, transferring only data that has changed. The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection.

How do I install rsync?

Use any one of the following commands to install rsync. If you are using Debian or Ubuntu Linux, type the following command:
# apt-get install rsync
OR
$ sudo apt-get install rsync
If you are using Red Hat Enterprise Linux (RHEL) / CentOS 4.x or older version, type the following command:
# up2date rsync
RHEL / CentOS 5.x or newer (or Fedora Linux) user type the following command:
# yum install rsync

Always use rsync over ssh

Since rsync does not provide any security while transferring data it is recommended that you use rsync over ssh session. This allows a secure remote connection. Now let us see some examples of rsync command.

Comman rsync command options

  • --delete : delete files that don't exist on sender (system)
  • -v : Verbose (try -vv for more detailed information)
  • -e "ssh options" : specify the ssh as remote shell
  • -a : archive mode
  • -r : recurse into directories
  • -z : compress file data

Task : Copy file from a local computer to a remote server

Copy file from /www/backup.tar.gz to a remote server called openbsd.nixcraft.in
$ rsync -v -e ssh /www/backup.tar.gz jerry@openbsd.nixcraft.in:~
Output:
Password:
sent 19099 bytes  received 36 bytes  1093.43 bytes/sec
total size is 19014  speedup is 0.99
Please note that symbol ~ indicate the users home directory (/home/jerry).

Task : Copy file from a remote server to a local computer

Copy file /home/jerry/webroot.txt from a remote server openbsd.nixcraft.in to a local computer's /tmp directory:
$ rsync -v -e ssh jerry@openbsd.nixcraft.in:~/webroot.txt /tmp

Task: Synchronize a local directory with a remote directory

$ rsync -r -a -v -e "ssh -l jerry" --delete /local/webroot openbsd.nixcraft.in:/webroot

Task: Synchronize a remote directory with a local directory

$ rsync -r -a -v -e "ssh -l jerry" --delete openbsd.nixcraft.in:/webroot/ /local/webroot

Task: Synchronize a local directory with a remote rsync server or vise-versa

$ rsync -r -a -v --delete rsync://rsync.nixcraft.in/cvs /home/cvs
OR
$ rsync -r -a -v --delete /home/cvs rsync://rsync.nixcraft.in/cvs

Task: Mirror a directory between my "old" and "new" web server/ftp

You can mirror a directory between my "old" (my.old.server.com) and "new" web server with the command (assuming that ssh keys are set for password less authentication)
$ rsync -zavrR --delete --links --rsh="ssh -l vivek" my.old.server.com:/home/lighttpd /home/lighttpd


File transfer in background using SCP

For scping large files, it is best to let them run in the background.

follow the steps below to transfer files using SCP command in the background

1) execute the normal scp command, eg:
# scp localfile.tar.bz2 user@server.ch:/path/on/server/

2) after confirming the key and authentificating (if necessary), you can "stop" the job by pressing : ctrl + Z
[1]+ Stopped scp localfile.tar.bz2 user@server.ch:/path/on/server/

3) then you can proceed the job in the background by typing
# bg
[1]+ scp localfile.tar.bz2 user@server.ch:/path/on/server/ &


4) finally, to make sure the process is working in background, issue the “jobs” command
# jobs
[1]+ Running scp localfile.tar.bz2 user@server.ch:/path/on/server/ &


Now the session can be exited with the file transfer unaffected.

Thursday, November 29, 2012

How To Install Kloxo Free Control Panel - Step Wise Tutorial.


Kloxo Installation Guide

Prerequisites

1) A dedicated or virtual server running CentOS or Red Hat EL 5.x. CentOS 6.x is not currently supported.
2) At least 256 MB of RAM (enough to run Yum).
3) At least 2 GB of free disk space for Kloxo and related services.
4) If you partitioned your disks manually, make sure you have a large /tmp. Kloxo uses /tmp to create and store backups temporarily and the process will fail if there is not enough space.

Before we begin...

You have to disable SELinux by editing /etc/sysconfig/selinux and changing the line to selinux=disabled. This will keep SELinux from being enabled on your server next boot.

Then you must run the following command as root to disable SELinux for the current session:

# su - root
# setenforce 0


If you are unsure this procedure worked, you can run /usr/sbin/sestatus to check its status. Failure to correctly disable SELinux will render your Kloxo install useless and an OS reload may be required to properly reinstall it.
Also, make sure the ports 7778/tcp and 7777/tcp are open in your server firewall or you won't be able to connect to Kloxo web panel when the install completes.

Installing Kloxo

Kloxo installation consists of downloading kloxo-installer.sh from download.lxcenter.org and executing it as root. The script will present you with a few questions and sometimes ask for a password (enter your root password).

If you don't have MySQL server already installed, you must run:

# su - root
# yum install -y wget
# wget http://download.lxcenter.org/download/kloxo/production/kloxo-installer.sh

To install as Master (Default Single Server):
# sh ./kloxo-installer.sh --type=master

To install as Slave:
# sh ./kloxo-installer.sh --type=slave


If you already have MySQL installed and set a root password, you must run:

# su - root
# yum install -y wget
# wget http://download.lxcenter.org/download/kloxo/production/kloxo-installer.sh
# sh ./kloxo-installer.sh --type= --db-rootpassword=PASSWORD


Once kloxo is installed, you can connect to http://YOUR_SERVER_IP:7778 and you will be presented with a login screen. Login as admin with password admin and once you are in, Kloxo will ask you to change the default password to a secure one.

How to Restore a Full Cpmove File Using Whm.

Restoring a full cpmove file or cpanel complete backup file is very easy using the whm interface. The only condition is that the cpmove file or the cpanel backup file should be in any of the below directory:

/home
/usr/home
/web
/home2
/home3
/root
/usr

So if you have the backup file at any other location then please move it to any of the above location otherwise you will not be able to restore the cpanel account using WHM.

Open the whm >> backup >> restore a cpmove file option.

Then you will be able to see the cpmove file available to restore.
Just put the username of the cpanel account that you can see in the backup file name too and its done !

Thats it !

Note: The username must match the name in cpmove file. you may see a list of cpmove files with different names, so only put the name which you want to restore.
Cool