- 1)
% ssh-keygen -t rsa -b 4096 Generating public/private rsa key pair.
Enter file in which to save the key (~/.ssh/id_dsa): (just press Enter)
Enter passphrase (empty for no passphrase): (enter a passphrase and then press Enter or if you don't want want one just press Enter)
Enter same passphrase again: (repeat last action)
Your identification has been saved in ~/.ssh/id_rsa
Your public key has been saved in ~/.ssh/id_rsa.pub
The key fingerprint is:
A long string appears here
% - 2)
Paste the content of the ~/.ssh/id_dsa.pub file that just got generated on your local host into the file ~/.ssh/authorized_keys on the remote host and save. - 3)
Set proper permissions on your local host keys and .ssh directory:
chmod 700 ~/.ssh
chmod 644 ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/id_rsa
set proper permissions on your remote host authorized_keys and .ssh directory
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
Showing posts with label automation. Show all posts
Showing posts with label automation. Show all posts
How to setup SSH private and public keys
Labels:
authorized_keys,
automation,
chmod,
Enterpise Linux,
id_rsa,
id_rsa.pub,
linux,
linux administraion,
passphrase,
permissions,
private key,
public key,
redhat,
REL,
rsa,
shell,
ssh,
ssh-keygen,
tar bar,
unix
How to take a Java thread dump from a shell/bash script
We already know how to get a Java thread dump manually. But what if we want to take a Java thread dump from a script to help us automate things.
To do this we need to come up with a ps and grep combination that will only return one result. so grep as many times as neccessary and/or use keywords that are only found in your process name so you only get one result.
Remember to add [] somewhere in your first grep so grep doesn't matches itself.
To do this we need to come up with a ps and grep combination that will only return one result. so grep as many times as neccessary and/or use keywords that are only found in your process name so you only get one result.
Remember to add [] somewhere in your first grep so grep doesn't matches itself.
output=$(ps -ef | grep m[y]ProcesseName )Then all you need to do is sending the QUIT signal to $2 which stores the PID of your process.
kill -QUIT $2So just add the above two lines to your script after modifying the first line to fit your needs and you should be good to go.
Labels:
automation,
bash,
Enterpise Linux,
Java,
JVM,
kill,
linux,
script,
shell,
thread dump,
unix
Subscribe to:
Posts (Atom)