Category: linux

How to Change Timezone in CentOS

You check the time from the command line (run date), and find that the timezone is set to UTC or some other timezone. How do you get this changed?
To change this you have to have root access to the server.

There are a series of time zone files located at /usr/share/zoneinfo. Select the appropriate named timezone for your location. For my location I would need , Kolkata, Asia.

Make note of the appropriate folder and file for your timezone. The active timezone used on your system is in the /etc/localtime file.

First, make a backup of the existing localtime file. It’s always safe to make backups of original config files.

sudo mv /etc/localtime /etc/localtime.bak_01012015

Next, create the link:

sudo ln -s /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

To test your change run the date command. You will see the new time.

Timezone issue with cron

If your cron job timing does’t match with the server time zone for example. You have set the cron to run at 12:30 PM, but when you see the cron log the time show say 3:40 PM. So to run your cron job as per your time zone Say if you are in India, your cron job should run as per Indian time. So you have to add the following line before your cron job line.

CRON_TZ=”Asia/Kolkata” ## This is the important line
03 18 * * * wget http://www.abc.com/test.php >> /var/www/html/abc/logs/test-`date +\%Y\%m\%d`.log

`date +\%Y\%m\%d` => This will create the log as per date month and year wise. Date format enclosed by tick (`) sign

drupal clean URLs not working? with tilde sign

If your site is developed in Drupal and your URL looks like this:

If your site URL looks like this:

http://[domain name OR IP Address]/~[accountname]/anyFolder/

Example
http://example.com/~xyzaccount/somefolder/
http://xxx.xxx.xxx.xxx/~xyzaccount/somefolder/

Then you need to set RewriteBase!in your .htaccess file that looks like below

RewriteBase /~xyzaccount/somefolder

create high quality video using ffmpeg

You can use the open source ffmpeg program to convert a media file from low quality to high quality format

[shellprompt]# /fullpath/to/ffmpeg/ffmpeg -i source.mp4 -c:v libx264 -crf 19 destinationfile.flv

OR

[shellprompt]# /fullpath/to/ffmpeg/ffmpeg -i source.mp4 -c:v libx264 -ar 22050 -crf 28 destinationfile.flv

Parameter explained
-crf XX is the quality of the video you are looking for. It’s between 0 and 51 (but between 17 and 23 it’s a reasonable range and the lowest the number is, the better quality the video is going to be).

For the -ar 22050 it’s for adjusting the audio sample range (audio quality). You can choose 11025, 22050 or 44100.

For many other example and details explanation refer Tutorial for FFMPEG

How to convert bitmap image(.jpg , .jpeg, .gif, .png) to vector format (.ai , .eps, .svg)

For converting bitmap image to vector image you need to have autotrace library installed .

If you not installed you can install that bu using the command “yum install autotrace”.

Follow the instruction step till the installation is complete.

Once its installed you can use the below command to convert the image to vector format.

$ autotrace testInputImage.png -output-file testOutputImage.svg

Other example :

$autotrace –input-format=jpg –output-file=tshirt.ai –dpi=1024 –color-count=256 –despeckle-level=0 –despeckle-tightness=0 –corner-always-threshold=60 –line-threshold=0.1 –width-weight-factor=0.1 –line-reversion-threshold=0.1 –preserve-width –remove-adjacent-corners tshirt.ai 2>&1

and your are done.

For more information and option visit http://autotrace.sourceforge.net

Thanks