Heres a simple script I needed to execute if user found in
passwd file and if user not found in passwd file.
[root@unixguy scripts3]# cat verify.sh
#!/bin/bash -x
if grep $USER /home/sriram/scripts3/pass.txt;
then
#If user is found
perl script.pl;
else
#If user Not found
bash script.sh;
fi
[root@unixguy scripts3]#
Sunday, March 25, 2007
Delete Files older than two Months from the Latest File
This script should Identify the Latest date file and delete files
which are older than 2 Months from latest date.
bash-3.00$ cat delet_old.sh
#!/bin/bash
touch -d "$(date -d "$(ls -lt | awk 'NR==2{print $6,$7}') 2 months ago")" FILE_MARK &&
find . ! -newer FILE_MARK -exec rm -f {} \;
which are older than 2 Months from latest date.
bash-3.00$ cat delet_old.sh
#!/bin/bash
touch -d "$(date -d "$(ls -lt | awk 'NR==2{print $6,$7}') 2 months ago")" FILE_MARK &&
find . ! -newer FILE_MARK -exec rm -f {} \;
Subscribe to:
Posts (Atom)