Computer Scientist

Wednesday, 28 March 2012

Stop auto clean the Fedora's /tmp directory

In Fedora, the files that stored in /tmp directory seems would be removed after a certain period of time without operation on it. Which kind of time (last modification time, create time or read time) can be set using different parameters when invoke a program named tmpwatch. Beware in mind, this works only in Fedora series. I am not sure for other Linux distributions.

The tmpwatch is a watching program that is invoked daily-based by cron. A script is also called tmpwatch is in /etc/cron.daily/ directory to invoke the program in /sbin directory.

In my case, I want to keep my file in /tmp directory without bothering with the tmpwatch's auto-removing. So I am able to set myself to be a exclude user by -U parameter for tmpwatch in shell scripts in cron directory.

And it should be work.

Friday, 2 March 2012

Add column to existing table

mysql how to add columnMany ways to add column to existing table in MySQL. If you r using GUI tools, add column to table in MySQL is easy. If you are using CLI, then here’s the command to add column in MySQL table.
To add column in existing table, you may refer to the 2 examples below:-
Example I: Add new varchar column to the end of the table
ALTER TABLE `tablename_here` ADD `new_column_name` VARCHAR( 255 ) NOT NULL ;
Example II: Add new integer column after an existing column in table
ALTER TABLE `tablename_here` ADD `new_column_name` INT NOT NULL AFTER `existing_column` ;
It’s simple to add column to existing table right? :)