July 2014
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  

Categories

July 2014
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031  

zmapachectl

#!/bin/bash # # ***** BEGIN LICENSE BLOCK ***** # Zimbra Collaboration Suite Server # Copyright (C) 2005, 2007, 2008 Zimbra, Inc. # # The contents of this file are subject to the Yahoo! Public License # Version 1.0 (“License”); you may not use this file except in # compliance with the License. You may obtain […]

restart of service

echo is_uid=`/usr/bin/id | /usr/bin/awk -F\= {‘print $2’} | /usr/bin/awk -F\( {‘print $1’}` if [ $is_uid -ne 0 ] ; then echo “You are not logged on as root” exit ; fi # DNS, name server, bind ; case “$1” in ‘dns’|’bind’|’named’) if [ -f “/usr/local/etc/named.pid” ] ; then named_pid=`cat /usr/local/etc/named.pid` kill -HUP $named_pid echo […]

Apache restart

#!/bin/bash # # apache Start the apache HTTP server. # # The variables below are NOT to be changed. They are there to make the # script more readable. NAME=apache DAEMON=/usr/sbin/$NAME PIDFILE=/var/run/$NAME.pid CONF=/etc/$NAME/httpd.conf APACHECTL=/usr/sbin/${NAME}ctl # note: SSD is required only at startup of the daemon. SSD=`which start-stop-daemon` ENV=”env -i LANG=C PATH=/bin:/usr/bin:/usr/local/bin” SHIB_HOME=/opt/shibboleth-1.3 LD_LIBRARY_PATH=${SHIB_HOME}/libexec:${SHIB_HOME}/lib export LD_LIBRARY_PATH […]

Shell to find directory and execute

#!/bin/bash KNOWN_PATH=”/usr/sbin /sbin /opt/apache2/bin /usr/local/sbin” HTTPD_DIR= for path in $KNOWN_PATH; do echo “trying $path/httpd…” if `ls $path/httpd > /dev/null 2>&1`; then HTTPD_DIR=$path break fi done if [ -z $HTTPD_DIR ]; then echo “httpd path not found, please enter the path to directory where httpd is” echo -n “httpd path : ” read HTTPD_DIR fi HTTPD=”$HTTPD_DIR/httpd” […]

SED

FILE SPACING: # double space a file sed G # double space a file which already has blank lines in it. Output file # should contain no more than one blank line between lines of text. sed ‘/^$/d;G’ # triple space a file sed ‘G;G’ # undo double-spacing (assumes even-numbered lines are always blank) sed […]

EXT3-fs error (device hda3) in start_transaction: Journal has aborted

EXT3-fs error (device hda3) in start_transaction: Journal has aborted

If your system abruptly loses power, or if a RAID card is beginning to fail, you might see an ominous message like this within your logs:

EXT3-fs error (device hda3) in start_transaction: Journal has aborted

Basically, the system is telling you that […]

Solaris Grep

grep on Solaris

Today I was asked by a colleague how to match a regex in a text file and return a specific number of lines both before and after the match. GNU grep has a very easy solution for this; the -A/B/C flags, as shown on my […]

Format date for display or to use in a shell script

Q. How do I format date to display on screen on for my scripts as per my requirements? A. You need to use standard date command to format date or time for output or to use in a shell script.

 

Syntax to specify formatdate +FORMAT Task: Display date in mm-dd-yy formatType the command as […]