Archive

Archive of : Linux Stuff

Bandwidth usage report per IP address

I created a simple python script for collecting data from mikrotik accounting (documetation) feature. Here is my “mik_collector.py” script: all you need to change is router_ip variable to match your router IP after that you can run this script simply with this command: python mik_collector.py this will collect data from...

Temporary Disabling Bash History

Let’s assume that you want execute some command that you don’t want in your history (e.g. commands with  passwords), but you don’t want to clear your entire history because of these. all you need to do is to run the following command: unset HISTFILE or HISTFILE=/dev/null this will disable...

Get current db2 database size

Today I needed to get database size for one of my databases. I find a partial solution here. My first choice was this stored procedure, which needs to be called from command line:

Check log files with grep

I sometime need to check some logs and I do this with this command: egrep -o "p1|p2|...|pn" filename | sort | uniq -c Example: egrep -o "success|error|fail" test_file | sort | uniq -c Sample input: test started at 00:00 test delete fail test error test connect success test insert...

Backup (from command line)/Restore OpenFiler

Backup Openfiler When I need a Openfiler backup for the first time, I did this: 1. Log in OpenFiler Web UI 2. Click System 3. Click Backup/Restore 4. Click Download This works well if you have time to do this steps every day… but if you don’t want to...

Power on/off script for Xen Running VMs on XenServer

Days ago I needed a script to power on/off my runing VMs on XenServer… In my case I needed this to power off VMs when my UPS is running on batery and later to power on when the power comes back. I was looking for a script that can...

Auto complete for already used command line commands?

To use auto-complete of already used command line command we just need to edit the following lines: