├── README ├── apache_top5log.py ├── bash-web-server.sh ├── block_daemon ├── README ├── block_daemon.pl ├── block_daemon_wrapper.sh └── block_ip_daemon.sh ├── carp ├── check_carp.sh └── check_carp_wrapper.sh ├── check_areca.sh ├── check_disk_dmesg.pl ├── check_disks.pl ├── check_domain.pl ├── check_http.py ├── check_md.sh ├── check_md5sums_script.sh ├── check_raid_etegro.sh ├── check_snmp_disk.sh ├── chroot_ssh_freebsd.sh ├── cpu_util_linux_bsd.py ├── create_lxc.sh ├── disk_iostat.pl ├── geoupdate.sh ├── host_checker.py ├── ipfw_rules.sh ├── iptables_rules.sh ├── jail_make ├── Makefile ├── README ├── fstab.in └── rc.config.in ├── java_prof.sh ├── kickstart ├── ks.cfg ├── ks.cfg_default └── make_ks.sh ├── kill_ppid.py ├── logrotate.sh ├── mailx_wrapper.py ├── merger.sh ├── mongo_reclaim.sh ├── mongodb_backup.sh ├── mp3.sh ├── mysql_pgsql_backup ├── mysqlbackup.sh ├── mysqldumpslow ├── mysqlhotbackup.sh ├── mysqlhotcopy ├── pgsqlbackup.sh └── slowlogstats ├── mysql_replica_watcher.py ├── mysqlbackup_snapshot.sh ├── pgsqlbackup.sh ├── prich_nginxconf.sh ├── send_xmpp_message.py ├── squid ├── allowed_urls ├── denied_urls ├── extended_access_group └── squid.conf ├── svnconfbackup.conf ├── svnconfbackup.sh ├── svncreat.sh ├── tail_with_thread.sh ├── template_bash_script.sh ├── template_python_script.py ├── top_ip_address.sh ├── usbmodem_watchdog.sh ├── users_whitelist.sh ├── webdiff.sh ├── whatsapp_install.sh └── win_installed_pkg_list.ps /README: -------------------------------------------------------------------------------- 1 | some useful admin scripts 2 | -------------------------------------------------------------------------------- /apache_top5log.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | # top5log 25 < apache.log 4 | # where the argument 25 represents how many days ago the day of interest is (the default is 1, i.e., yesterday), and apache.log is the name of the log file, which the script reads via stdin. The output looks like this: 5 | 6 | # Jul 03, 2013 pages 7 | # 907 /all-this/2013/06/feedle-dee-dee/ 8 | # 813 /all-this/ 9 | # 749 /all-this/2013/07/last-i-hope-thoughts-on-rss/ 10 | # 74 /all-this/2007/03/improved-currency-conversion-card/ 11 | # 74 /all-this/2009/08/camry-smart-key-battery-replacement/ 12 | # 7134 total 13 | 14 | 15 | import re 16 | import sys 17 | from datetime import datetime, date, timedelta 18 | from collections import Counter 19 | 20 | # Define the day of interest in the Apache common log format. 21 | try: 22 | daysAgo = int(sys.argv[1]) 23 | except: 24 | daysAgo = 1 25 | theDay = date.today() - timedelta(daysAgo) 26 | apacheDay = theDay.strftime('[%d/%b/%Y:') 27 | 28 | # Regex for the Apache common log format. 29 | parts = [ 30 | r'(?P\S+)', # host %h 31 | r'\S+', # indent %l (unused) 32 | r'(?P\S+)', # user %u 33 | r'\[(?P