How To Install, Create/Detach And Kill Screen Processes In Linux

Linux Logo Screen process is used to open another screen window within your current active shell. We use this command to run those processes which requires to be running in the back ground all the times. Just like you have developed a specific application and you always start it from command line and when you disconnect your current server shell the process dies as well. Or you are copying a large size data from one server to another and your start in the screen and then attach/detach screen after regular intervals to check the process.

How to Install Screen:

Yum works fine on almost all Linux distros, so the following command takes care of the screen installation:

yum instal screen

How to create a new screen processes: simple run the screen command, and you will see a new window flashing up in the terminal, start your process and get out of the screen.

How to Exit from Screen:

Exiting or detaching screen is also easy, when you in screen press CTRL+ X and you will be out, leaving the screen process running intact.

How To Enter/Attach Screen

: Check the process name for screen first:

ps –ef | grep screen

Now enter into screen by running screen –r Pid, like  Pid of screen processes is 12, we will attach that screen as :

screen –r 12

Terminating/Killing Screens:

Grep Process id of the screen as described above and then run the kill command to kill the processes. Cheers!

A Guide To: What Is Apache Mod_SSL, How To Configure And Install SSL In Linux [Self-Signed Certificate]

Apache Mod_SSL:

Lets first understand that what are SSL. SSL stands for Secure Socket Layer and it adds an enhanced level of security to the web transactions, Basically SSL is used to secure the communication between the web browser and web servers. Whenever you submit information’s within the web forms, the SSL ensures that this data is submitted to the server in encrypted and secure format so that the hackers should not intercept with your confidential and crucial data.Installing SSL certificates on your domain requires that your server should have Apache Mod_SSL already installed/enabled.

How To Install Mod_SSL:

If you are running Apache Version 2, then its very easy to enable the Mod_SSL. Simply login into your Linux server via command prompt and run the following yum command:

yum install mod_ssl

It will take couple of minutes and get the required module enabled for your apache version. Go to /etc/httpd/conf.d folder and you will see ssl.conf file added here and also it lets apache listen on it secure i.e. 443 ports itself, you don’t need to do manual changes in apache configuration files. But if you installed it via source then you will need to add the following line in your httpd.conf

Listen 443

Self Signed Vs Trusted Certificates:

It is always recommended that you get your SSL certificate purchased from any SSL providing authority, such certificates are called trusted certificate and are much more secure. But if you don’t want to purchase, then you can also generate your own SSL certificate. Although the encryption mechanism of such certificates are not much strong but they are fine to suffice basic level of security. We will discuss about how to generate and Install Self-Signed Certificates.

» Read more

/usr/libexec/at-spi-registryd [Something Your Shouldn’t Worry About]

Gnome I have habit of monitoring my Linux servers regularly, today all of sudden I found a new process running which invoked my hidden curiosity, The process name is /usr/libexec/at-spi-registryd. It was consuming major system resources especially CPU. I googled and here is what I found.

This package contains the major and the most important components of GNOME Accessibility. Just Make sure that if you need to use Assistive technology, thn install it. Also another reason which I infered is that my server was running Linux run level five. On runlevel three servers I could not find this process. Cheers!

Apache Stealth Process[Something Your Should Worry About]

Linux Logo Yesterday I was monitoring my Linux server and I noticed a process name “Stealth” running under the ownership of apache user. It was sucking the whole system’ CPU and was causing the real production applications to slow down.

I  Google it and found that its something bad, basically hackers get it installed on different servers and the most commonly reason for the presence of this process is IRC chat program. If you are not running such sort of chat Servers then the presence of stealth process is really alarming.

In such scenarios, do one thing. Find out from where the process is running, kill it and if possible delete the working directory of this process. Just like in my case, I found it running from /var/tmp directory and there were so many unknown files. Once you kill the process then it is always recommended to restart apache service. Cheers!

Backup Your Linux System With Simple Backup[SBackup]

I cant believe that such idiots exist in 21st century who don’t bother to keep their system properly backed up. Whether you are Mac user,Windows fan or Linux expert, you should keep your system properly backed up so that you should have at least a recovery point available if anything goes wrong. Today I found yet another great simple utility for Linux users which backups up system within minutes. The installation and working of this tool is dead simple. Here you can find complete details on how it works. Further, this works on almost all flavours of Linux.

How To Enable Pinning In The Yum Repository

Majority of the software which you install in Linux are via its Yum repository. Sometimes any particular software is not included in the default repository of Yum and we will to include any third party repository to our Yum configuration to get this done.  Lets suppose, you have installed any particular software say PHP via yum repositories, now whenever you will run yum update * command, yum will install the updated packages of all software including PHP as well, what if you don’t want PHP to be upgraded ? Here comes the concept of Pinning. Pinning mechanism tells you to ignore which software packages from upgrades/downgrade. In simpler terms, you lock packages to certain versions.

Enabling pinning for some repository is very easy, go to /etc/yum.repos.d directory and open the .repo file of the particular package you want to pin and append the following line to it.

protect=1

That’s it, now the particular repository will be locked and no more upgrades/downgrades will be installed for this onwards. Cheers!

Bash Script To Monitor MySQL Replication

If you are using Mysql replication to ensure 24/7 uptime of your application, then you might have seen the situation when replication stops working due to some small problem on either master or slave server. Once any error occurs, mysql by defaults stops the replication process and dont proceed with replicating the changes from master to slave.

I have googled a lot and found couple of useful bash scripts from geeks, I have modified and merged them and here is a script which works well and notified you via email alerts if replication process is broken. All you need to do is that change the IP addresses of your master and slave server along with the email address at which you wish to receieve alerts.

Here is the script:

status=0
MasterHost=”192.168.0.1″
SlaveHost=”192.168.0.2″
emails=”aun@linuxchunks.com”
ReplicationDownAlert=”Replication status – Down”
ReplicationGoodAlert=”Replication status – Good”
ReplicationGoodMessage=”Everything regarding MySQL replication on $SlaveHost is good.\nHave a great day!\n\n”

#Grab the lines for each and use Gawk to get the last part of the string(Yes/No)
SQLresponse=`mysql -u root –password=xxxxxx test -e “show slave status \G” |grep -i “Slave_SQL_Running”|gawk ‘{print $2}’`
IOresponse=`mysql -u root –password=xxxxx test -e “show slave status \G” |grep -i “Slave_IO_Running”|gawk ‘{print $2}’`

if [ "$SQLresponse" = "No" ]; then
error=”Replication on the slave MySQL server($SlaveHost) has stopped working.\nSlave_SQL_Running: No\n”
status=1
fi

if [ "$IOresponse" = "No" ]; then
error=”Replication on the slave MySQL server($SlaveHost) has stopped working.\nSlave_IO_Running: No\n”
status=1
fi

# If the replication is not working
if [ $status = 1 ]; then
for address in $emails; do
echo -e $error | mail -s $ReplicationDownAlert $address
echo “Replication down, sent email to $address”
done
fi

# If the replication is working fine
if [ $status = 0 ]; then
for address in $emails; do
echo -e $ReplicationGoodMessage | mail -s $ReplicationGoodAlert $address
echo “Replication is up, still sent email to $address”
done
fi

That’s it, Cheers!

Rails Requires RubyGems >= 1.3.2 (You Have 1.3.1)

You might have faced this issue during the installation of a well known software called Redmine. I followed the installation steps of redmine from this link, but when I run the following command, I see this error message:

rake db:migrate RAILS_ENV=”production”

The fix to this problem is very simple, RubyGems is one of the core depency of Redmine, so you have an old version of RubyGem which is no longer workable. Now upgrade your RubyGems to the required i.e. 1.3.2 version by the following three simple steps:

Download latest (1.3.2) version.

wget http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz

Once download is complete run the following command to unzip the downloaded file.

tar -xvf rubygems-1.3.2.tgz

Install it by typing the following command in the terminal window.

ruby setup.rb

That’s it you should be done with the installation within minutes, Now proceed with further installation steps of Redmine. Cheers!

CaC – Download And Convert Videos From Youtube, Google Video In Ubuntu Linux

Youtube and Google Videos are considered as giants when we talk about streaming sites over the internet. These sites claim to entertain millions of users per hour and users are crazily downloading videos from such sites. You may find hundreds of such tools which download and convert videos from such sites to different famous formats, but you could have a limited number of choice of such tools on Linux. Search should be over now, CaC (Catch and Convert) is a wonderful utility which runs on Ubuntu and lets you download and convert videos from such sites.

Installation

Installation process is extremely easy for even a novice Linux user. Download .deb file from the link specified at the end of the post. Once download is completed, double click the downloaded file and follow the onscreen installation wizards. Or alternatively, open the terminal, go to the downloaded location and run the following command:

./cac_0232_linux_beta.deb

Once the installation is over, you will see a nice, user-friendly and eye candy interface. Download and convert videos to any format you wish.

Download CaC

BigDump – Restore Large MySQL Dump Files

BigDump is one of the commonly used php scripts which comes in handy if you are to import a larg .sql file. The conditions unders which it proves to be useful are:

  • You dont have access to server’s shell (command prompt).
  • You dont have PhpMyadmin available.
  • Your webserver and php configuration dont allow the upload of max file sizes.

Running this script is pretty easy. simply download it, unzip it, ftp into your website and upload this bidump.php file. Once upload is complete, open it and set the DB Name, Username and Password of your mysql server and the database you are going to import it. Once done, save this file and open it in web browser as http://yourdomain.com/bigdump.php (offcourse you will need to replace yourdomain.com with the name of your domain).  Here you will be presented with an interface to upload .sql file and import it.

Okay, That’s it, now you can upload and restore large database dump file without any worry. Cheers! :)


« Older Entries