shell script

Linux Apache httpd init.d Script

It is usually a good practice to install the Apache httpd as the service on the linux server so that it can be added to system startup and does not require any intervention from user to start the Apache httpd server manually on every reboot. Linux servers like (CentOS, RHEL, […]

Shell Script To Update Spamhaus Lasso Spam Database for PF Firewall

#!/bin/sh # A shell script update Spamhaus Lasso Spam Database for PF Firewall # Put this script at /etc/periodic/daily/10.drop-lasso file. # Tested under FreeBSD 6.x and 7.x and PF Firewall # ————————————————————————- # Copyright (c) 2007 nixCraft project <http://www.cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or […]

IP Camera Capture Shell Script

Primitive IP Camera Capture Script Axis 210a Camera Use a Cron Job To Control #!/bin/sh – #Primitive IP Camera Capture Script #Axis 210a Camera #Use a Cron Job To Control #Tested under FreeBSD #Original author / source: http://forums.freebsd.org/showpost.php?p=12005&postcount=3 ROT=$(date “+%b%d%y%H%M”) CAPTOOL=/usr/local/bin/mencoder CAP_OPT1=”-prefer-ipv4 -fps 6 -demuxer lavf” CAP_OPT2=”-nosound -oac mp3lame -ovc […]

Bash For Loop Examples

Question: How do I use bash for loop to repeat certain task under Linux / UNIX operating system? How do I set infinite loops using for statement? How do I use three-parameter for loop control expression? Answer: A ‘for loop’ is a bash programming language statement which allows code to be repeatedly […]

Using tmpfs for MySQL tmpdir setting

This is incredible, by the way. Any time MySQL needs to use a tmp table on disk, you can make it use RAM disk instead. WARNING: if the tmpfs partition you make isn’t big enough, MySQL will not be able to complete queries. Make sure you have enough RAM to […]

How to do MAC address packet filtering using IPTables

Media Access Control address (MAC address) or Ethernet Hardware Address (EHA) or hardware address or adapter address is a quasi-unique identifier attached to most network adapters (NICs). It is a number that acts like a name for a particular network adapter, so, for example, the network cards (or built-in network […]

echo Command

Use echo command to display text or value of variable. echo [options] [string, variables…] Displays text or variables value on screen. Options -n Do not output the trailing new line. -e Enable interpretation of the following backslash escaped characters in the strings: \a alert (bell) \b backspace \c suppress trailing […]