Sync files to a remote location using rsync linux command and Ruby

Note: The entire approach highlighted in this blog about using the rsync command with Ruby is only applicable on Linux-based systems and won't be available on Windows. In this article, we will explore how to use rsync in Ruby to sync files from local to a remote location, how to improve its error logging and how rsync is better than scp. Let's first understand what is rsync: rsync is a Linux command to sync files from one location to another. We can run this command on the terminal and it will copy files from one directory to another, either locally

Auto startup scripts for services and apps

One of our production web application runs on a dedicated node in DO (Digital Ocean) cloud server. This web application has following services running. Elixir Phoenix API server React.js client server Redis caching server Bots (Slack) Few days back, Digital Ocean triggered an urgent maintenance for Meltdown and Spectre Mitigations resulting into a reboot of our PROD server. DO did alert us in advance by sending an email notification with schedules. But seems we missed these schedules accidentally. Thus, our PROD web application was suddenly down after this auto reboot / restart by DO forced maintenance. We realised that we

Upload files from command line using tranfer.sh

Ever stuck on a remote server with some file? Needed to upload/download file from remote server? Find FTP clients tedious for a simple file upload/download? Keep reading for one stop solution to all these problems. Many a times I fall in situation where I have to deal with remote servers and just to upload a file I have to open FTP clients and have to leave command line for such a simple task. I always wondered if, there was a command line way of doing simple FTP stuffs. Then few weeks ago I came across transfer.sh. As

Automating your Linux commands using bash because "Do Not Repeat Yourself".

It was normal Monday like every week. I got my laptop and pressed the Power button then I remembered that I had not Suspended(Hibernated) my machine but instead had shut it down last Friday to make sure the memory is not occupied and system runs faster . Now the problem with shutting down is, I have to start eight different servers to get my Crossroad's apps up and running. Just for this reason ,I refrained from Shutting Down my machine every day and instead chose to Suspend which would save me from hitting numerous keyboard keys and do the same

List of frequently used Linux - Ubuntu console commands

Following is an handy list of frequently used Linux (Ubuntu flavour) console commands Find Files find . -name '*.cnf' find . -name 'hello.workd' The dot here represents all files and folders in current path Mysql DUMP - Import and Export Export mysqldump -u username -p database_name > file_name_to_save.sql Import mysql -u username -p database_name Install LAMP on Ubuntu sudo apt-get install tasksel sudo tasksel sudo tasksel install lamp-server Install Apache2 on Ubuntu sudo apt-get update sudo apt-get install apache2 The /var/www path is the document root for the apache web apps. SCP - File

pagekite.net - fast and reliable localhost tunneling solution

You may have came across a situation where you need to share your local app to clients (in other words your Rails app running on your local server port 3000). You may have came across a situation where you need to share your local server. So in such cases a widely used tool is localtunnel But it has a limitation with consistent url as it generates a random URL for every new instance. Pagekite suffices this need and gives a consistent URL for one server bind to a port. PageKite makes local websites or SSH servers publicly accessible Getting Started