ULTIMATE USES OF SCREEN COMMAND

ULTIMATE USES OF SCREEN COMMAND

Image result for screen linux wallpaper
                                         


What is Screen Command?

Screen command is a UNIX command which is used to open multiple sessions on server. If somehow we lost ssh connectivity from remote server then the task which we were doing in that session will resume whenever we rejoin our session back. Screen command is very useful in backup scenarios.


Image result for screen command

INSTALLATION
For using screen command we have to install package of it by the following command

# yum install screen (Centos or Redhat)
# apt-get install screen (Ubuntu)

Real-Time Scenarios
1. IMAP MAIL SYNC FROM ONE SERVER TO OTHER
# imapsync --nosyncacls --syncinternaldates --host1 192.168.0.21 --user1 vivek.in --password1 pwd@123 --host2 192.168.0.25 --user2 vivek.in@lexicon.in --password2 pwd@123 --authmech1 LOGIN
2. DATA BACKUP FROM ONE TO OTHER SERVER
# vi script.sh
!/bin/bash
/usr/bin/screen
rsync -avz /home/* root@192.168.1.13:/home/
rsync -az /DTVLA/dtvla/*  root@192.168.1.13:/DTVLA/dtvla/ 
# crontab -e
0 12 * * * /bin/sh /root/script.sh
3. TERMINAL SHARE OF SAME SERVER
#screen -x
There are several suitable screens on:
       82726.pts-0.server      (Attached)
       82762.pts-2.server      (Attached)
Now we can switch to any of the attached screen and then we will in the shared terminal between two or multiple users.
#screen -x 82726 (PID of attached screen)

Thanks !!! :)

Comments