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 <pid></span> Leave it 10 seconds or a minute then ^C. That will tell you where…
Tag: Linux
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…
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 🙂 !
How to add a disk to LVM
Suppose the Disk is /dev/sdb, the second scsi disk, fdisk /dev/sdb create as many partitions as you need using command n Label them with command t as 8e for making it Linux LVM Write and Exit with the command w. Format the partitions you require using mkfs command mkfs -t ext3 -c /dev/sdb1 LVM commands…
Test if memcache is installed in php from bash line
php -i | grep -i memcache Short and sweet sample output : memcache memcache support => enabled memcache.allow_failover => 1 => 1 memcache.chunk_size => 8192 => 8192 memcache.default_port => 11211 => 11211 memcache.default_timeout_ms => 1000 => 1000 memcache.hash_function => crc32 => crc32 memcache.hash_strategy => standard => standard memcache.max_failover_attempts => 20 => 20 memcached memcached support…
Using Expect to automate an scp filetransfer
Sometimes you know passwords but are not ion a position to use shared keys. Solution is using expect to pass the password from a script read or a comman line parameter. ** NOTE Passwords in command lines are a really bad idea since you can see them in the history / ps -ef so best…
SVN checkout fails to authenticate
When running: svn checkout https://mysvn.mydomain.com:8443/svn/Linux/trunk/scripts/ –username *** –password ‘****’ I got : WARNING: gnome-keyring:: couldn’t connect to: /tmp/keyring-fTq763/pkcs11: No such file or directory Password for ‘default’ GNOME keyring: ***** svn: OPTIONS of ‘https://mysvn.mydomain.com:8443/svn/Linux/trunk/scripts’: authorization failed: Could not authenticate to server: rejected Basic challenge (mysvn.mydomain.com:8443) Problem could be damaged keyring or wrong keyring password. To fix…
Take picture from webcam using linux command line (bash)
From bash it’s easy to snap a photo from the webcam. mplayer -vo png -frames 1 tv:// That’s it.. Njoy 🙂
Moving a machine from one VM or physical box to another
This is the simple case where all we have is one disk that needs cloning. Assumptions for the following example Tools including backtrack distro available and permissible by company policy ( some c**ts get all agitated when sysadmins use a ‘knife’ to cut the ‘bread’ so be warned) Networking in place for the transfer preferable…