Skip to main content

Posts

How to execute multiple commands directly as ssh argument?

 Perhaps sometimes you need to do this: ssh user@10.1.2.3 ls It is easy understand the above: run ls after getting into 10.1.2.3 via ssh. Piece a cake Now comes something that I haven't thought it would happen. For simplicity, I would just paste the entire script (the actual script that I worked on was more complex, so I made simpler one) #!/bin/bash ssh root@192.168.56.101 ' if [[ '"x$1"' == "x-a" ]]; then         echo "-a is here" else         echo "not -a" fi '  The above script, let's name it test.sh  , just receive one parameter (I don't bother to do number of parameter check etc, btw). Let's assume 192.168.56.101 is a machine or VM somewhere. At the first encounter, you might wonder, "Good Lord, why write these multi lines command passed into ssh? Why not put them as script at the remote machine and invoke it via ssh?"  I also came to same initial conclusion at first, so basically this is the situat
Recent posts

How to make a container wait for other container in docker compose?

 Dear readers  Another day, another research is done. This time, it is related to docker, specificly docker compose  For those who don't know, docker compose is a way to start one or more container with certain attributes or parameters, so that you don't need to execute: docker run ..... everytime. Instead, you simply run: docker-compose up or similar command after you complete writing docker-compose.yml  The problem arise when you need to run something like this: version: "2" services:   database :      image: mysql   app:      image: custom_app Let's put aside what the app is doing and how app connect to mysql. The problem is how make sure mysql run first and fully ready before app tries to connect? The first solution that comes up to mind is to use depends_on like below: version: "2" services:   database :      image: mysql   app:      image: custom_app     depends_on:       - database   Sounds solid? Yes, on the surface. Try to run that and you will

Fixing failed FreeIPA web UI login

Dear readers This time I met interesting case, thus I think it is worth sharing it with you all. But first, big disclaimer. I AM NOT FREE IPA EXPERT AT ALL. The investigation done here simply use common trouble shooting sense in UNIX/Linux world, no more, no less. A calm weekend suddenly turned into detective work. A team mate contacted that he was unable to login to Free IPA web UI. The OS is CentOS 7 64 bit. For those who don't know what Free IPA is, think it's like LDAP-turned-into-ActiveDirectory-ish. What? You don't know what Active Directory is? You're not alone, me too :) The fact I got was this. Two Free IPA instances were setup on two different virtual machines, say A and B. On A, my mate could log in. Whereas on B, he couldn't. He insist that he did the same exact steps to configure IPA. So what's wrong? Since we're dealing with computer, we're dealing with basic logic concept: if you setup same software (and same version) using same ex

Sysadmin's tale: Fixing broken logical volume in Linux

Dear respected readers This time I'd like to share something related to troubleshooting in Linux. What makes me want to share it, is not about how sophisticated the step I did, but how awfully simple it was! Please read on. Ok, so it started when I was about to left my office. Then suddenly my phone rang and turned out to be whatsapp message from my colleague, saying "we need your help". Anyway, before we proceed, let's state one thing: I try my best to reconstruct the situation based on my brain's memory, so I beg you pardon if something is missed. I hope that still deliver the message. ......Oh and, one more thing, lately when I read "we need your help", I began to think it actually means "we're in deep shit". Hehehehe The situation is as follow: my co-worker said that a SAN connection was disconnected without clear reason. Thus, it made multipath construction broke and eventually one or more mount points unmounted. And the goal:

Sysadmin tales: Analyzing slow database server

Update: June 14th, 2016 6:01 PM UTC+7: using direct I/O or raw access also bypass filesystem caching. This also has effect to avoid double caching. I dare to guess Oracle does caching. So if everything cache, we would have: device caching, page cache, Oracle's own caching. Direct I/O eliminates page caching. Dear readers It's been awhile since my last post, so I guess I'll try to share something that might be useful for perfomance monitoring. This is something that I focus at now, and I found tightly related to OS knowledge. So please read on. One day, I was urgently assigned by upper management to help identify certain (unknown) problem in Linux server. I quickly visited the site and did various checking. The reported issue was that this server (a RHEL/CentOS one) was terribly slow at certain time. This server is running Oracle DB and running certain CRM software, as VM on top of VMWare. So slow that you barely could not do anything in ssh shell or interactive

VirtualBox bugs: guest can not ping host and vice versa

Hi all Happy New Year 2016. May God bless us with health and prosper. Okay, just quick update. I found quite annoying fact: VirtualBox version 5.0.4 has bug: in bridged adapter mode, host can not ping guest VM and vice versa! I googled about this and some people had early conclusion that it might be related to bugs in NDIS6 adapter. However, there is easier workaround: just make sure you upgrade to latest version (version 5.0.12 as January 12th, 2016). Or, just stay in 4.3.x version. In my personal opinion, so far version 4.3.x ( which is still in active maintenance mode) is more stable than 5.0.x. Hope it helps somebody out there..... regards, Mulyadi Santosa

Fixing segfault in Pathload

Dear readers Couple days ago (it's 1st week of July 2012), I came across this nifty tool called Pathload . Essentially, it helps you determine the real upstream and downstream connection of yours. Inaccidentally, when I tried to run it, it segfaulted immediately. With a bit help of gdb and trial/errors, I found and fix the bug. Here's the complete email message that I sent to its maintainer (which is I find no longer maintain it anymore) describing the problem. For those who just seek for the patch, just scroll to the end of this post (normal patch format): Dear Constantinos I came across this nice tool Pathload of yours today while exploring about network management in Linux kernel. Of course, quickly I downloaded the link to the source tarball (I use Linux -- Centos 5.x) and compiled it. When running it, it suddenly stopped due to segfault. After checking the stack trace in the resulting core dump image, it leads to line 132 in client.c:   strcpy(serverList[i]