LAMP How To – Open Source At Work

Only Passion Matters

Entries for January, 2010

syncing date and time in command line

having the wrong date and time in the system can be disastrous as many applications will be using the system date and time. It is therefore very important to have the right date and time.
In linux,

yum install ntp
chkconfig ntp on
ntpdate pool.ntp.org
service ntpd start

You can add the ntpdate command to cron to automate the syncing process. [...]

Starting and stopping vmware in linux command line

One advantage of using command line is that you can start and stop the VM without logging into the web console. I am using vmware server 2.0. I believe it should work the same for future versions.
To start and stop certain instance, say ares,

vmrun -T server -h ‘https://10.2.115.21:8333/sdk’ -u root -p ‘yourpass’ start “[standard] [...]

using variables in cron

unlike normal bash scripts, you can’t really use the back ticks to execute a certain command like so

DATE=`date +%F`

In crontab, you have to use the $(), eg

$(date +\%F)

fsck on lvm partition

fsck on lvm can be a bit tricky. Like a the normal process, the partition needs to be umounted and we can boot up using the rescue cd or in emergency mode. Normally, you

fsck /dev/sda1

if the partition is lvm, you need to activate the lvm first like so

vgchange –ignorelockingfailure -ay
lvscan –ignorelockingfailure (this command should now [...]

SVN commits fail- Can’t get exclusive lock

this could be due to many reasons. If your data is in a nfs mounted drive, restart nfs and it should fix the problem.