colorize your logs

CCZE is a robust and modular log colorizer with plugins for apm, exim, fetchmail, httpd, postfix, procmail, squid, syslog, ulogd, vsftpd, xferlog, and more.

For installation

sudo yum install ccze

and to use it:

tail -f -n 50 /var/log/firewalld | ccze
#or better yet
cat  /var/log/firewalld | ccze|more

apache in docker to serve local website

I have some backup’s of website on my laptop, which I occasionally want to view. Now, I could have setup apache to serve them directly with VirtualHost or alias but wanted a better solution. So, docker comes to rescue.

First, I installed fedora-dockerfiles and then made some modifications, here they are :

sudo yum install fedora-dockerfiles

After this is done, go to /usr/share/fedora-dockerfiles/apache and make some modification to Dockerfile.  After the modifications, the file looks like this

FROM fedora
MAINTAINER “Scott Collier” <[email protected]>

RUN yum -y update; yum clean all
RUN yum -y install httpd; yum clean all
RUN echo “Apache” >> /var/www/html/index.html

EXPOSE 80

# Simple startup script to avoid some issues observed with container restart
ADD run-apache.sh /run-apache.sh
ADD php.conf /etc/httpd/conf.d/php.conf
RUN chmod -v +x /run-apache.sh
RUN yum -y install php

CMD [“/run-apache.sh”]

 

Now copy the php.conf file to current directory.

sudo cp /etc/httpd/conf.d/php.conf .

#Build the docker image
docker build --rm -t apache .

#and then quickly test the image like this -
docker run -t -i --rm -p 80:80 apache

#open the site in firefox
firefox -new-tab http://loccalhost

Once you see that the docker is running fine, time to create a script to do this in your desired directory.
I always have “~/bin” in $PATH, so I created ~/bin/docker.sh file with the following contents:

#!/bin/bash -
#===============================================================================
#
#          FILE: docker_firefox.sh
#
#         USAGE: ./docker_firefox.sh
#
#   DESCRIPTION:
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka)
#      REVISION:  ---
#===============================================================================

dir="your/desired/directory/with/content/for/website"
echo "Run Ubu website:::"
CID=$(docker run  -d -p 80:80  -v $dir:/var/www/html:ro apache)
echo docker CID is $CID
firefox -new-tab http://localhost/index.php

After this time to test:

Just run this script and you should have the contents of current directory in your browser.

Nice discussion on Control Panel ( free ) for VPS.

http://xmodulo.com/free-control-panel-for-vps.html

 

Enjoy the discussion and information if you are looking for free control panel for VPS or some other host.

repotrack and repoquery -commands to resolve dependencies.

To get all the depencies of a package, you can try:

repoquery -a --requires --resolve 

Example output:
glibc-0:2.20-5.fc21.i686
bash-0:4.3.30-2.fc21.x86_64
chkconfig-0:1.3.63-1.fc21.x86_64
glibc-0:2.20-5.fc21.x86_64
openssl-libs-1:1.0.1j-1.fc21.x86_64

and then to query in nice tree format, you can use :

 repoquery -a --tree-requires PACKAGE_NAME

And finally use that with repotrack:

repotrack -a x86_64 -p . $(repoquery --qf=%{name} -g --list --grouppkgs=all 'Office Suite and Productivity' |tr '\n' ' '
)

Now for the fun part, why use all the above when you can simply use:
yumdownloader --resolve 

So, if you have reached this line then you don't need repotrack/repoquery, simply use yumdownloader :)

PHP Image gallery with fancybox.

So, I was looking for some quick to setup PHP Image gallery file. I found couple but none of them suited my needs too well. So I had to write my own.

Very simple PHP script to show all the images under ‘images’ folder.

Shows some details in the images.

 

That is all that I wanted and that is all that this script does. So pretty simple single php file. Dependency is on fancybox so you will need the jquery and all but nothing else is required.

https://github.com/raj77in/PHP-ImagaeGallery.git

script to get hard disk health in fedora/ubuntu

First, put this in a script.

#!/bin/bash

#Change as appropriate
HDD=sda

export sub="SmartCtl data for HDD"
echo 'To: <Your Email>
Sub: [Cron] $sub
MIME-Version: 1.0
Content-Type: text/html
Content-Disposition: inline

<html><pre>'


echo '<style>

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #ccc;
    margin: 1em 0;
    padding: 0;
}
</style>
'

echo '<h2>Errors on HDD:</h2>'
echo '<hr>'
sudo smartctl -l error  /dev/$HDD
echo '<h2>Health of HDD:</h2>'
echo '<hr>'
sudo smartctl -H  /dev/$HDD

echo '<h2>Detailed info</h2>'
echo '<hr>'
sudo smartctl -a -d ata /dev/$HDD

echo '<h2>Journalctl output for smartd</h2>'
echo '<hr>'

if [[ -f /etc/fedora-release ]]
then
journalctl -x --show-cursor -u smartd --since=yesterday
else
#This is for Ubuntu.. still using dmesg

dmesg -T -l err,crit,alert,emerg

fi


echo '<h2>All Details</h2>'
echo '<hr>'

sudo smartctl --xall /dev/$HDD


echo "Thanks for using Amit Agarwal's script"
echo '</pre></html>'

and then put this in cron:

30 15 * * 5 <script name> |/usr/sbin/sendmail -t

You need to have mail configured to receive the mails.

Whaaw! light weight media player

Description : Whaaw! Media Player is a lightweight media player that supports fullscreen
            : mode, seeking, changing video colour settings and more. It will play any audio
            : or video files that GStreamer can play. It is intended to be a basic media
            : player without any GNOME dependencies.

So, this is light weight media player with not too many features but does good as a simple media player.

To install:

 

sudo yum install whaawmp