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
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