Programming
Delete Old Files In Unix
Unix Shell Scripts
Written by Ross Alvarez   
Tuesday, 16 May 2006 13:05

To delete old files in unix, you can execute the following command from the shell:

find <path> -mtime +30 -exec rm -f {} \;

For example, to delete all file more than 30 days older:

find /tmp -mtime +30 -exec rm -f {} \;


Last Updated on Saturday, 14 March 2009 07:25
Read more...
 
Shell Script Iterate Through Array Values
Unix Shell Scripts
Written by Ross Alvarez   
Tuesday, 14 February 2006 18:11
The following script will loop through the array values and print them out, one per line. Additional statements can be placed within the loop body to take further action.
# names store in "names" array.
names=( Dave Chris John Rob )

# here's how you iterate
for name in ${names[@]}
do
   echo $name
   # additional actions
done

Real world example:
# List of jobs
JOBS=( bp_daily1.sh cpn_daily1.sh )

# execute all jobs
for JOB in ${JOBS[@]}
do
   nohup $SRCDIR/${JOB} ${PROCESS_DATE} > $LOGDIR/${JOB}.out &
done
Last Updated on Tuesday, 14 February 2006 18:19
 
Combine Files In One Big File
Unix Shell Scripts
Written by Ross Alvarez   
Friday, 15 July 2005 08:20
cat <all_files> > <big_file>

e.g.:

cat *.csv > master.csv

Last Updated on Saturday, 14 March 2009 21:57
 
Easy Flash Banner, In Minutes!
Flash
Written by Ross Alvarez   
Monday, 28 March 2005 12:02
SWiSH - Create Flash animaton the easy wayDo you notice the MamboServe Hosting flash banner? It's the first flash media banner that I have created for this website. It only took me few minutes to build using SWiSHmax. SWiSHmax is a powerful Flash creation tool. With 230 new effects, a Javascript-like scripting language and support for dynamic content and input forms, SWiSHmax has everything you need to create fully interactive Flash presentations. Unfortunately, it's not free. But you can try it out free for 15 days. Enough time to make 100 banners! Get SwishMax!

Check out the sample code that I used for the entire banner. I assume you know at least a little bit about Flash such as topics about scenes and frames.
Last Updated on Monday, 04 April 2005 15:37
Read more...
 
Backing Up Remote MySQL Database To Your Local Desktop
SQL
Written by Ross Alvarez   
Saturday, 26 March 2005 03:37
MySQL Administrator A very important task to do when you have a website is "always make a backup". For website that collects database data, it is recommended to do the backup process daily. Fortunately, most webhosting provider have this feature on their control panel. Just click and it's done or you can even schedule it. When a disaster occur, you can just always go through your backup and go from there. But, this process sometimes is not reliable. For additional peace of mind, this how-to will focus more on backing up your MySQL database seperately.

Continue Reading in MamboHacks.com.

Last Updated on Saturday, 14 March 2009 09:11
 
Clear Arguments By Shifting
Unix Shell Scripts
Written by Ross Alvarez   
Friday, 25 February 2005 21:46
$ arguments in shell script are not cleared after execution. For example execute a script “exec.sh arg1″, arg1 is assigned to “$1″. When you execute “exec.sh” again without the argument, $1 value is retained. Using “shift” and by assigning argument to a variable will solve this problem:
# get arguments
EXTRA=""
until [ $# -eq 0 ]
do
EXTRA=$EXTRA" "$1
shift;
done

 
Shell Script Trigger Variable
Unix Shell Scripts
Written by Ross Alvarez   
Friday, 25 February 2005 21:45
This is an example on how to set a variable trigger in your k-shell script:
# set 0 for false, 1 for true
VARTRIGGER=1
.
.
((VARTRIGGER)) && execute_anything;


 
Cut File Lines
Unix Shell Scripts
Written by Ross Alvarez   
Friday, 25 February 2005 21:44
This example creates a copy of a file’s first 10 lines:
head -10 orig.file > new.file

 
See File
Unix Shell Scripts
Written by Ross Alvarez   
Friday, 25 February 2005 21:44
od -t x <file> 
 
Delete Lines In VI
Unix Shell Scripts
Written by Ross Alvarez   
Friday, 25 February 2005 21:43
set -o vi
<esc><> for auto completion
<esc><=> for list of possibilities
 
<< Start < Prev 1 2 Next > End >>

Page 1 of 2

Networks
JoomlaHacks | Technovibe | PinoyProfessionals | MamboServe
© Ross Alvarez