If there are many files and your ls, rm or mv commands not working you can use one of these
find /path/to -name 'yourfiles*' | xargs rm
find /path/to -name 'yourfiles*' | xargs -i mv {} anildel/
find /path/to -name 'yourfiles*' -exec rm '{}' \;
find /path/to -name 'yourfiles*' -exec rm '{}' +
Thursday, 27 March 2008
Wednesday, 12 March 2008
Sendmail Troubleshooting
First of all I recommend enabling logging. Edit /etc/syslog.conf and be careful about using tab between entries.
mail.debug /var/log/mail.log
Restart syslog daemon
/etc/init.d/syslog restart
Check /var/log/mail.log.
You can find brief information about sendmail Email flow
http://sial.org/howto/sendmail/
Also some troubleshooting docs from HP
http://docs.hp.com/en/B2355-90685/ch04s11.html
http://docs.hp.com/en/5991-6611/ch02s10.html
mail.debug /var/log/mail.log
Restart syslog daemon
/etc/init.d/syslog restart
Check /var/log/mail.log.
You can find brief information about sendmail Email flow
http://sial.org/howto/sendmail/
Also some troubleshooting docs from HP
http://docs.hp.com/en/B2355-90685/ch04s11.html
http://docs.hp.com/en/5991-6611/ch02s10.html
Shell script Get the time difference
Get difference
date1=`date +%s`
commands
..
..
.
date2=`date +%s`
date -d "00:00:00 $(( ${date2} - ${date1} )) seconds" +"%H:%m:%S"
date1=`date +%s`
commands
..
..
.
date2=`date +%s`
date -d "00:00:00 $(( ${date2} - ${date1} )) seconds" +"%H:%m:%S"
Wednesday, 5 March 2008
Sed and awk, find pattern and get next lines
Search pattern and print next two lines. You can add more getline and print here for awk and n;p for sed. Also you can do it via +2p
Get between two pattern
This is small script do same another way.
awk '/pattern/{getline;print;getline;getline;print}' file
sed -n '/pattern/{n;p;n;p;}' file
sed -n '/pattern/,+2p' file
Get between two pattern
awk '/pattern1/,/pattern2/' file
sed -n '/pattern1/,/pattern2/p' file
This is small script do same another way.
pattern=yourpattern
bgn=$(grep -n $pattern scsconfig.log awk -F: {'print $1'})
ed=`expr $bgn + 3`
cat scsconfig.log sed -n ''$bgn','$ed'p'
Subscribe to:
Posts (Atom)