Starting vnc on Display 0 ( local display ) from a remote ssh session

i.e. You wnet home need your desktop have ssh no vnc !! Here is the easy solution..

Install x11vnc.

$ DISPLAY=localhost:0 x11vnc &

connect to the display using vnc et voila !

BTW Teamviewer also USED TO WORK but no longer in ver 8 so thanks VNC for not being obsolete..

nJoy 🙂

 

Monitoring a bottleneck with strace

If let’s say Mysql is slow at performing a task you can check what is the bottleneck using strace to attach to the process.

<span style="color: #00ff00;">$ ps -ef|grep -i mysql</span>

Identify the process id then

<span style="color: #00ff00;">$ strace -cp &lt;pid&gt;</span>

Leave it 10 seconds or a minute then ^C. That will tell you where the process is spending its time, e.g. it could just be waiting for the disk if you seen read and write dominate.

Njoy 🙂

Start Teamviewer from an ssh session remotely

So you remote deskptop rebooted and teamviewer did not run on startup as it does not do in Linux for some strange reason:

Connect with ssh ( putty)

Then run

DISPLAY=`localhost`:0 teamviewer&

Njoy 🙂 !

Enable VMWare time sync from command line

Virtual machines and NTP do not go easily well together. Machines paused for extended periods tend to loose the ntp sync since the difference grows too much.

 

Also from VMware Docs the following info might be clarificatory:

  • Do not configure the virtual machine to synchronize to its own (virtual) hardware clock, not even as a fallback with a high stratum number. Some sample ntpd.conf files contain a section specifying the local clock as a potential time server, often marked with the comment “undisciplined local clock.” Delete any such server specification from your ntpd.conf file.
  • Include the option tinker panic 0 at the top of your ntp.conf file. By default, the NTP daemon sometimes panics and exits if the underlying clock appears to be behaving erratically. This option causes the daemon to keep running instead of panicking.
  • Follow standard best practices for NTP: Choose a set of servers to synchronize to that have accurate time and adequate redundancy. If you have many virtual or physical client machines to synchronize, set up some internal servers for them to use, so hat all your clients are not directly accessing an external low-stratum NTP server and overloading it with requests

And :

In ESX, the ESX NTP daemon runs in the service console. Because the service console is partially virtualized, with the VMkernel in direct control of the hardware, NTP running on the service console provides less precise time than in configurations where it runs directly on a host operating system. Therefore, if you are using native synchronization software in your virtual machines, it is somewhat preferable to synchronize them over the network from an NTP server that is running directly on its host kernel, not to the NTP server in the service console. In ESXi, there is no service console and the NTP daemon runs directly on the VMkernel, so it works well as a NTP server for virtual machines.

Quoted from : http://www.vmware.com/files/pdf/techpaper/Timekeeping-In-VirtualMachines.pdf

Easy way (And I think best solution is)

  1. Setup NTP client to ESX
  2. Install VMWARE tools on the Guests ( recommended anyways).
  3. In Linux ( cause that’s what we care about ) run vmware-toolbox-cmd timesync enable

To force a sync run hwclock command.

nJoy 🙂 !

 

 

One Liner to test php sending mail from a bash script

To check if your php installation can successfully send emails from a bash script try this :

 php -r ‘var_dump(mail(“david.saliba@testemail.com”, “test subject”, “test body”));’

Thanks Gareth !

nJoy 🙂 !