Monday, November 19, 2012

How to synchronize clock between time

In order to synchronize the clock time between servers, you must have one reference server. In our example tlvntp1.tlv.lpnet.com
Then, all your server should refer to it . That's the way to do it:

1) In your file /etc/ntp.conf, you should have the following line:

server tlvntp1.tlv.lpnet.com
My System Administrator did the following shortcut:
echo server tlvntp1.tlv.lpnet.com > /etc/ntp.conf

But be careful with it, since it may delete other synchronization option the file already has.


2) To be synchronized with our IT ntpserver (the one with the good clock time)
service ntpd restart

3) Then ntpq -p
to display what the offset with the synchronized server  (the tlvntp1) 
The offset should reduce after few minutes ....

This apparently means what is the offset between your current server and the referenced ntp server ( here, for ex, rstm02 and rstm18 etc ...)
michaelz@roor-wto128:~$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+rstm02.lpdomain 64.236.96.53     2 u  162 1024  377    0.320    4.600   0.049
+rstm18.lpdomain 204.9.54.119     2 u  150 1024  377    0.337    5.579   0.063
*rstm09.lpdomain 64.236.96.53     2 u  173 1024  377    0.358    1.196   0.035
 rstm07.lpdomain 172.16.22.71     2 u  551 1024  377    0.777  -42.128   3.369
 rstm06.lpdomain 172.16.22.71     2 u  884 1024  377    2.675  -94.770  96.884


Same, but without host name resolving (-n option)
michaelz@roor-wto128:~$ ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+10.16.23.11     64.236.96.53     2 u  168 1024  377    0.320    4.600   0.049
+10.16.22.18     204.9.54.119     2 u  156 1024  377    0.337    5.579   0.063
*10.16.23.21     64.236.96.53     2 u  179 1024  377    0.358    1.196   0.035
 10.16.22.61     172.16.22.71     2 u  557 1024  377    0.777  -42.128   3.369
 10.16.22.71     172.16.22.71     2 u  890 1024  377    2.675  -94.770  96.884


4) Synchronize time between two servers
In order to synchronize the time between two different servers (no need to have an ntp server in between):

ntpdate -u the-second-host-server





To synchronize your Windows with an external NTP server, do the following:
net time \\tlvdc1 /set /y    
where, tlvdc1 is the host  name of yoru NTP server

Monday, October 29, 2012

Change background color in linux/unix terminal xterm

 Useful link for modifying the background color.
Especially useful when working with multiple terminal, on different machines ...


http://unix.stackexchange.com/questions/16120/in-bash-how-can-i-change-the-color-of-my-command-prompt

Put in your ~/.bashrc

# Color mapping
grey='\[\033[1;30m\]'
red='\[\033[0;31m\]'
RED='\[\033[1;31m\]'
green='\[\033[0;32m\]'
GREEN='\[\033[1;32m\]'
yellow='\[\033[0;33m\]'
YELLOW='\[\033[1;33m\]'
purple='\[\033[0;35m\]'
PURPLE='\[\033[1;35m\]'
white='\[\033[0;37m\]'
WHITE='\[\033[1;37m\]'
blue='\[\033[0;34m\]'
BLUE='\[\033[1;34m\]'
cyan='\[\033[0;36m\]'
CYAN='\[\033[1;36m\]'
NC='\[\033[0m\]'
Step 2. Re-define your PS1 variable:
PS1="$yellow[$CYAN\t$yellow][$red\H$yellow][$GREEN\w$grey$yellow]$NC# "
 
 
 or more details also can be found here:
 
https://wiki.archlinux.org/index.php/Color_Bash_Prompt
 

Prompt escapes

The various Bash prompt escapes listed in the manpage:
Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters that are decoded as follows: \a an ASCII bell character (07) \d the date in "Weekday Month Date" format (e.g., "Tue May 26") \D{format} the format is passed to strftime(3) and the result is inserted into the prompt string an empty format results in a locale-specific time representation. The braces are required \e an ASCII escape character (033) \h the hostname up to the first `.' \H the hostname \j the number of jobs currently managed by the shell \l the basename of the shell's terminal device name \n newline \r carriage return \s the name of the shell, the basename of $0 (the portion following the final slash) \t the current time in 24-hour HH:MM:SS format \T the current time in 12-hour HH:MM:SS format \@ the current time in 12-hour am/pm format \A the current time in 24-hour HH:MM format \u the username of the current user \v the version of bash (e.g., 2.00) \V the release of bash, version + patch level (e.g., 2.00.0) \w the current working directory, with $HOME abbreviated with a tilde \W the basename of the current working directory, with $HOME abbreviated with a tilde \! the history number of this command \# the command number of this command \$ if the effective UID is 0, a #, otherwise a $ \nnn the character corresponding to the octal number nnn \\ a backslash \[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt \] end a sequence of non-printing characters
 

Thursday, September 13, 2012

XMing + Putty for remote desktop on ubuntu

Well, I didn't work with Remote Desktop but I was told (Omri) that I can work instead with specific remote application, using XMing + Putty.

Explanation there:
http://www.math.umn.edu/systems_guide/putty_xwin32.html


In few word, start XMing server.
Then, run putty and configure your SSH session to your remote desktop / ubuntu use X-Forwarding.

Then, the putty console can open XTerm and all other graphics ...

Sunday, July 1, 2012

Connect to jconsole to a remote server

Recently, I've encountered problem for connecting jconsole to my remote server (it was tomcat server). Locally, it did work but remotely, it didn't,
I used JDK 1.7 (it may be linked ... ) and ubuntu (it may be linked also).

So I've added the following property:
-Djava.rmi.server.hostname=michael-ubu 


and it started working ...

Here's the doc that finally helped me:

http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/javarmiproperties.html


java.rmi.server.hostname
The value of this property represents the host name string that should be associated with remote stubs for locally created remote objects, in order to allow clients to invoke methods on the remote object. The default value of this property is the IP address of the local host, in "dotted-quad" format.






This one also helped me:

I had a similar, if not the same, problem. I could connect to the JMX server if I started jconsole locally on the machine.
It appears the RMI server was not listening on the correct ip. So, as was suggested in this related question, I added the following:
-Djava.rmi.server.hostname=<host ip>
to JAVA_OPTS as well, and then it worked.



Sunday, June 10, 2012

Remote desktop to Ubuntu

I struggle a lit for accessing my Ubuntu desktop from a windows computer.
I use team viewer which gives a full solution, that overcomes the con security wall .
But I also discovered recently the realvnc viewer, which is quite fast and precise, and requires only a simple executable without installation.

Monday, June 4, 2012

Ubuntu linux Remove Global AppMenu

In order to remove the Global AppMenu on the top screen and have the window standard app menu on the top of each window, do the following:

sudo apt-get remove indicator-appmenu


There's also way to remove the global menu for specific application only (i.e only for firefox , idea etc ...)

Thursday, May 24, 2012

IDEA JetBrain intellij

I started using IDEA instead of eclipse ...
First impressions:
I don't like their GUI
I do like their integration with spring/tomcat/everything ...
I do like the fastness in search ...

Some tip for newbies and for ubuntu / linux user:

1) when clicking on Switch-Tab for moving between application, I don't see the IDEA icon.
Solution: http://devnet.jetbrains.net/thread/435242


intellij-launcher.png

Please remove your launcher, start IDEA from a terminal, invoke a Tools | Create Desktop Entry action, exit IDEA, and restart session. After that you'll have a correct main menu entry which displays right icon in a switcher and is pinnable to Unity launcher.






2) Good link for better navigation in IDEA:

like here:

Quick switch of the current scheme

screenshot
There is no need to dig deep into the settings dialogs hierarchy when you need to apply another Color/Code style Scheme, Keymap or even Look and Feel of the application. This can be achieved with a short series of shortcuts. Just press Ctrl + BackQuote and then the number of the scheme to change.