1. mkdir -p /u01/app_shared/oracle/admin/archive
2.chmod -R 775 /u01/app_shared/oracle/admin/
3. chown -R hrisidm:hrisidm /u01/app_shared/oracle/admin/
Nullable files creation:
cat /dev/null > logfile
EX: cat /dev/null > sde.log
=============================
find . -type f -size +120000000c -exec lsof {} \;
find /u01 -type f -mtime +365 -exec rm '{}' \;
find /u01 -type f -mtime +365 -exec lsof '{}' \;
find /tmp/sess_* -mtime +1h -exec rm {} \;
#!/bin/bash
find /tmp/sess_* -mtime +1h -exec rm {} \;
As per the man page for find, I understand that this is expected behavior:
-mtime n
File’s data was last modified n*24 hours ago. See the comments
for -atime to understand how rounding affects the interpretation
of file modification times.
-atime n
File was last accessed n*24 hours ago. When find figures out
how many 24-hour periods ago the file was last accessed, any
fractional part is ignored, so to match -atime +1, a file has to
have been accessed at least two days ago.
ctime
ctime is the inode or file change time. The ctime gets updated when the file attributes are changed, like changing the owner, changing the permission or moving the file to an other filesystem but will also be updated when you modify a file.
mtime
mtime is the file modify time. The mtime gets updated when you modify a file. Whenever you update content of a file or save a file the mtime gets updated.
Most of the times ctime and mtime will be the same, unless only the file attributes are updated. In that case only the ctime gets updated.
atime
atime is the file access time. The atime gets updated when you open a file but also when a file is used for other operations like grep, sort, cat, head, tail and so on.
Examples:
# perform nightly cleanup of log files older than 8 days
49 23 * * * ( find /u01/app/kumar/applications/prd/doh/log -mtime +8 -exec rm {} \; ) > /dev/null 2>&1
# perform nightly cleanup of report files older than 2 days
48 23 * * * ( find /u01/app/kumar/applications/prd/doh/bin/reports -mtime +2 -exec rm {} \; ) > /dev/null 2>&1
# perform nightly cleanup of dart files older than 10 days
47 23 * * * ( find /u01/app/kumar/applications/prd/doh/dart/bkup -mtime +10 -exec rm {} \; ) > /dev/null 2>&1
cd \u01
find . -name "*.lok" -print -exec lsof {} \;
cd \u01
find . -name "*.lok" -print -exec rm {} \;
cd /u01
find . -name "*.DAT" -print -exec lsof {} \;
cd /u01
find . -name "*.DAT" -print -exec rm {} \;
Clear the files content using cat,:> and truncate commands:Null files
1) cat /dev/null>access.log
2) :> access.log
3) truncate -s 0 access.log
If you specify the size as 0, the contents of the file will be cleared. Let’s confirm this
4) stat file.txt
===========================================================================================================
grep -in "25/Nov/2014" access_log | head
----------------------------------------
aims@asl175:/u900/app/apache2063/logs> grep -in "25/Nov/2014" access_log | head
19908668 :136.236.108.1 - - [25/Nov/2014:05:11:25 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot HTTP/1.1" 200 685912
19908669:136.236.108.1 - - [25/Nov/2014:05:11:52 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot HTTP/1.1" 200 419
grep -in "25/Nov/2014" access_log | tail
----------------------------------------
aims@asl175:/u900/app/apache2063/logs> grep -in "25/Nov/2014" access_log | tail
19912445:136.236.14.241 - - [25/Nov/2014:15:56:53 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot&CustomService=query HTTP/1.1" 200 925
19912446:136.236.14.241 - - [25/Nov/2014:15:56:53 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot&CustomService=query HTTP/1.1" 200 925
19912447:136.236.14.241 - - [25/Nov/2014:15:56:54 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot&CustomService=query HTTP/1.1" 200 925
Finally its stored in one fail used into below sed command:
sed -n '19908668,19912447p' access_log > /tmp/access_log.txt
-----------------------------------------------------------------------------------------------------------------
3) :%s/oldstring/correntstirng/g
4) mailx -s "hello" -a /supportdocs/mware/home/information_15042014.txt surendra.swamy@brisbane.qld.gov.au
5) rm `ls -l|grep "Apr" |grep access_log |awk '{print $9}'`
6) ls -l|grep "May" |grep *der |grep 2011 |awk '{print $6 " " $7 " " $8 " " $9}'
7) rm `ls -l|grep "May" |grep *der |grep 2011 |awk '{print $6 " " $7 " " $8 " " $9}'`
8) scp -rp file_name oracle@prd-ofmw02-101:/u9000/app/oracle/product/java/
9) ls -lrt *.fmb | wc -l
10 . sh /u01/soa_soasuite_shared/app/oracle/admin/aserver/soa_domain/bin/startWebLogic.sh
ctrl+z
bg
disown
netstat:
¦ Oracle Management Agent Port = 3872, 1830 - 1849
To verify if a port is free, run the following command:
¦ On Unix:
netstat -anp | grep
example : netstat -apn | grep 3872
------------------------------
2.chmod -R 775 /u01/app_shared/oracle/admin/
3. chown -R hrisidm:hrisidm /u01/app_shared/oracle/admin/
Nullable files creation:
cat /dev/null > logfile
EX: cat /dev/null > sde.log
=============================
find . -type f -size +120000000c -exec lsof {} \;
find /u01 -type f -mtime +365 -exec rm '{}' \;
find /u01 -type f -mtime +365 -exec lsof '{}' \;
find /tmp/sess_* -mtime +1h -exec rm {} \;
#!/bin/bash
find /tmp/sess_* -mtime +1h -exec rm {} \;
As per the man page for find, I understand that this is expected behavior:
-mtime n
File’s data was last modified n*24 hours ago. See the comments
for -atime to understand how rounding affects the interpretation
of file modification times.
-atime n
File was last accessed n*24 hours ago. When find figures out
how many 24-hour periods ago the file was last accessed, any
fractional part is ignored, so to match -atime +1, a file has to
have been accessed at least two days ago.
ctime
ctime is the inode or file change time. The ctime gets updated when the file attributes are changed, like changing the owner, changing the permission or moving the file to an other filesystem but will also be updated when you modify a file.
mtime
mtime is the file modify time. The mtime gets updated when you modify a file. Whenever you update content of a file or save a file the mtime gets updated.
Most of the times ctime and mtime will be the same, unless only the file attributes are updated. In that case only the ctime gets updated.
atime
atime is the file access time. The atime gets updated when you open a file but also when a file is used for other operations like grep, sort, cat, head, tail and so on.
Examples:
# perform nightly cleanup of log files older than 8 days
49 23 * * * ( find /u01/app/kumar/applications/prd/doh/log -mtime +8 -exec rm {} \; ) > /dev/null 2>&1
# perform nightly cleanup of report files older than 2 days
48 23 * * * ( find /u01/app/kumar/applications/prd/doh/bin/reports -mtime +2 -exec rm {} \; ) > /dev/null 2>&1
# perform nightly cleanup of dart files older than 10 days
47 23 * * * ( find /u01/app/kumar/applications/prd/doh/dart/bkup -mtime +10 -exec rm {} \; ) > /dev/null 2>&1
cd \u01
find . -name "*.lok" -print -exec lsof {} \;
cd \u01
find . -name "*.lok" -print -exec rm {} \;
cd /u01
find . -name "*.DAT" -print -exec lsof {} \;
cd /u01
find . -name "*.DAT" -print -exec rm {} \;
Clear the files content using cat,:> and truncate commands:Null files
1) cat /dev/null>access.log
2) :> access.log
3) truncate -s 0 access.log
If you specify the size as 0, the contents of the file will be cleared. Let’s confirm this
4) stat file.txt
===========================================================================================================
grep -in "25/Nov/2014" access_log | head
----------------------------------------
aims@asl175:/u900/app/apache2063/logs> grep -in "25/Nov/2014" access_log | head
19908668 :136.236.108.1 - - [25/Nov/2014:05:11:25 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot HTTP/1.1" 200 685912
19908669:136.236.108.1 - - [25/Nov/2014:05:11:52 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot HTTP/1.1" 200 419
grep -in "25/Nov/2014" access_log | tail
----------------------------------------
aims@asl175:/u900/app/apache2063/logs> grep -in "25/Nov/2014" access_log | tail
19912445:136.236.14.241 - - [25/Nov/2014:15:56:53 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot&CustomService=query HTTP/1.1" 200 925
19912446:136.236.14.241 - - [25/Nov/2014:15:56:53 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot&CustomService=query HTTP/1.1" 200 925
19912447:136.236.14.241 - - [25/Nov/2014:15:56:54 +1000] "POST /servlet/com.esri.esrimap.Esrimap?client=eview&ServiceName=ibimap_tot&CustomService=query HTTP/1.1" 200 925
Finally its stored in one fail used into below sed command:
sed -n '19908668,19912447p' access_log > /tmp/access_log.txt
-----------------------------------------------------------------------------------------------------------------
3) :%s/oldstring/correntstirng/g
4) mailx -s "hello" -a /supportdocs/mware/home/information_15042014.txt surendra.swamy@brisbane.qld.gov.au
5) rm `ls -l|grep "Apr" |grep access_log |awk '{print $9}'`
6) ls -l|grep "May" |grep *der |grep 2011 |awk '{print $6 " " $7 " " $8 " " $9}'
7) rm `ls -l|grep "May" |grep *der |grep 2011 |awk '{print $6 " " $7 " " $8 " " $9}'`
8) scp -rp file_name oracle@prd-ofmw02-101:/u9000/app/oracle/product/java/
9) ls -lrt *.fmb | wc -l
10 . sh /u01/soa_soasuite_shared/app/oracle/admin/aserver/soa_domain/bin/startWebLogic.sh
ctrl+z
bg
disown
netstat:
¦ Oracle Management Agent Port = 3872, 1830 - 1849
To verify if a port is free, run the following command:
¦ On Unix:
netstat -anp | grep
example : netstat -apn | grep 3872
------------------------------
No comments:
Post a Comment