Here’s an easy way to change the prompt in Unix Shell
export PS1="[\W]$ "
This will use the current directory as command prompt
Here’s an easy way to change the prompt in Unix Shell
export PS1="[\W]$ "
This will use the current directory as command prompt
When you write a shell scripts you need to create filename with date in it. For example instead of log file name “bauson.log”, you can create a filename called “jan-02-06-bauson.log”.
The date in file will make it easy to find out all logs or reports. You can display the current date and time in the given FORMAT using date command. If you just type date command it will display in standard FORMAT:
$ date
Output:
Mon Nov 9 10:54:57 PHT 2009
To display date in MONTH-DAY-YEAR format you need to use date command as follows:
$ date +"%b-%d-%y"
Nov-09-09
As you can see I have used FORMAT as follows
date +”FORMAT”
Where, FORMAT can be any one of the following:
First obtained date:
$ NOW=$(date +"%b-%d-%y")
Create a file with date in filename:
$ LOGFILE="$NOW-bauson.log"
Display Filename
$ echo $LOGFILE
Usage:
10 7 * * * NOW=$(date +"%b-%d-%y"); LOGFILE="$NOW-bauson.log"; php my.php >log/$LOGFILE
I found mysql tuning is a pain. This script is a good tool to adjust your mysql variables. It evaluates the following variables:
slow query count
long_query_time
query_cache_size
% query cache actually used
max_connections
thread_cache
key_buffer_size
ratio of sort_merge operations to sorts (sort_buffer_size)
number of full joins
ratio of disk tmp tables vrs in memory tmp tables (tmp_table_size)
table_cache
ratio of table locks immediate to table locks waited
ratio of table scans (read_buffer_size)
To use the script add your user name and password to a [client] group in your ~/.my.cnf file
Recent Comments