Debuggging bash cron scripts.

2014-09-01 1 min read Bash Learning

I have to several times debug scripts that I get complain about working when logging in normally but they do not work when run in cron mode. So, quite a lot of times, redirecting the stderr of the script is all that is required to see what is happening, but sometimes that just does not help if the script is calling another script which is mis-behaving and under lot of other conditions. So, how to at-least take a look at why these are failing, login with ssh.

Continue reading

ldap search function

2014-08-25 2 min read Bash Learning

First you will need the ldap search utility. The client for ldap search comes in openldap-clients, so you need to install that first:

sudo yum install openldap-clients

Now, that you have installed it, try to find something in some open ldap server, example:

ldapsearch -LLL -h  db.debian.org   -x  -b "dc=debian,dc=org" "cn=Joao*"

This should list couple of entries for you. Now, that you have ldapsearch working, lets define a function in .bashrc file:

Continue reading

rfc2html – php script to view rfc with index and links.

2014-07-21 2 min read Learning Linux

If you have to keep viewing RFC’s and you miss index and links in RFC while viewing rfc, then you should check-out rfc2html. It is scrtip that takes plain text rfc and converts it to html.

You can get the original code from sourceforge.

However, I found some small issues with the script and have sent a mail to the authour about the same. In the meantime, you can use the diff below to fix the issue’s or download this diff file rfc2html.diff and apply the diff:

Continue reading

get the contents of whole site like some wiki or wikia

2014-02-24 1 min read Learning Uncategorized

For wikis and wikia, generally if you are trying to get some url mirror, then websucker.py is an excellent option. This script is in the python sources so, to get this tool,

yumdownloader --source python

Install the rpm downloaded in current directory and then go to ~/rpmbuild/SOUURCES.  You should find a Python-*.tar.xz file here, just extract with

tar xvf Python*.tar.xz

and there you go, you should find the tool in Tools/webchecker/websucker.py.

Continue reading

inotify -watch for file to change

2014-01-28 1 min read Learning Linux

Here is a simple command for you. It uses inotify tools. So first you need to install :

sudo yum install inotify-tools

and then you can try something like this:

while true; 
do 
inotifywait -r -e modify --exclude=".swp" . && make; 
done

Here, once the file changes, we are running make, but you can do anything you want.

 

 

Continue reading

cgroups – use to control your cpu and memory

2014-01-06 2 min read Fedora Firefox Learning

cgroups is a kernel feature and with userspace utilities, we can use the feature to control the cpu and memory for per process. So, lets first install the required tools.

sudo yum install libcgroup-tools

Now, we need to enable the service.

sudo systemctl enable cgconfig.service
sudo systemctl enable cgred.service

cgconfig.service is to enable configuration for cgroups and
cgred.service is to enable configuration for cgroups for processes depending on the name.

Continue reading
Older posts Newer posts