Skip to main content

Posts

Showing posts from November, 2008

BASH script to delete older files

# BASH Script to find files having Modification time older than 7 days and to remove. # A provisional confirmation before deletiion has been included # System files starting with "." in their names are excluded from deletion # And exclusive files that are specifies in the exclusion list are prevented from being deleted #!/bin/bash DIR=/home/hari LIST=/home/hari/DELETE_LIST EXCLUSIONS=/home/hari/EXCLUSIONS # Simply the below command will do it # find $DIR -type f -mtime +7 | grep ^./ | grep -v -f $EXCLUSIONS -exec rm {} \; # But for the time being it run on a CONFIRMATION before deleting the files. #Declaration for CONFIRM() CONFIRM() { echo "Going to remove $1" echo "Do you want to Continue? -y/n" read CHOICE if [ $CHOICE = 'y' ] then rm -f $1 elif [ $CHOICE = 'n' ] then exit else echo Invalid choice exit fi } # Function FIND_FILES FIND_FILES() { cd $DIR find

Install Linux from a remote machine

This comes into picture when one Admin doesn't have physical access to a system in which Linux needs to be installed. Here we need help from one person who is having physical access to that remote machine to get it booted from bootable media and to type the command shown below command at boot prompt. Now anaconda will start to run and will pause at a particular moment showing the below message Now try to telnet to this IP from a remote machine and proceed with installation steps as usual as we do as shown below