Warning: ftp_put(): Could not create file. in /public_html/ftp_dircheck.php on line 17
.Finished loading .
########################################
Scripts to restart the service automatically
########################################
#!/bin/bash
# Apache Process Monitor
# Restart Apache Web Server When It Goes Down
# ————————————————————————-
# Copyright (c) 2003 nixCraft project
# This script is licensed under GNU GPL version 2.0 or above
# ————————————————————————-
# This script is part of nixCraft shell script http://en.wikipedia.org/wiki/Shell_script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# ————————————————————————-
# RHEL / CentOS / Fedora http://en.wikipedia.org/wiki/Fedora Linux restart command
RESTART=”/sbin/service httpd restart”
# uncomment if you are using Debian / Ubuntu Linux
#RESTART=”/etc/init.d/apache2 restart”
#path to pgrep command
PGREP=”/usr/bin/pgrep”
# Httpd daemon name,
# Under RHEL/CentOS/Fedora it is httpd
# Under Debian 4.x it is apache2
HTTPD=”httpd”
# find httpd pid
$PGREP ${HTTPD}
if [ $? -ne 0 ] # if apache not running
then
# restart apache
$RESTART
fi
Then setup a cron job like this: (usually in your sa-update file under /etc/cron.d)
*/5 * * * * root /root/restart.sh >/dev/null 2>&1
#####################
Mail through Exim
#####################
#!/bin/bash
SUBJECT=”This is a test script for SSH Access”
EMAIL=”rkumar@transcomus.com”
EMAILMESSAGE=/tmp/test.txt
echo “To: rkumar@transcomus.com”, “cbellomy@transcomus.com” > $EMAILMESSAGE
#echo “cc: cbellomy@transcomus.com” > $EMAILMESSAGE
echo “Subject: this is a test subject” >> $EMAILMESSAGE
echo “This is a test Email for SSH Access” >> $EMAILMESSAGE
echo “This is email text” >> $EMAILMESSAGE
/opt/csw/sbin/exim -odf “$EMAIL” < $EMAILMESSAGE
##############################################
Run the script by providing the command line argument
##############################################
#!/bin/bash
cat /dev/null > /tmp/output.txt
count=0
while [ $count -lt $1 ]
do
echo “############################### Start of the Output ##################################################” >> /tmp/output.txt
statclient -h hkipnat >> /tmp/output.txt
echo “############################### $value Output Ends Here ##################################################” >> /tmp/output.txt
sleep 20
count=`expr $count + 1`
done
Perl Script to find out the free space on NRS DB srv
#!/usr/bin/perl
use strict;
use DBI;
my $database_username = “trans_dba”;
my $database_password = “bodaga”;
my $msdsn = q/dbi:ODBC:DSN=crsdb/;
my $dbh = DBI->connect( “dbi:Sybase:crsdb”, ‘trans_dba’, ‘bodaga’ )
or die “ERROR DBI::errstr”;
$dbh->do(“use crsdev”) or die “ERROR DBI::errstr”;
my $query = ‘declare @fspace float
exec look_free_space_db @fspace
print @fspace’;
my $sth = $dbh->prepare($query);
$sth->execute();
print “Disk Space : “;
do {
while(my $d = $sth->fetchrow_arrayref) {
if ($sth->{syb_result_type}==4040){
print join(“t”, @$d),”\n”;
}
}
} while($sth->{syb_more_results});
$sth=undef;
$dbh->disconnect;
############################
TIMEZONE CHECK ON SBC’s
############################
#!/bin/bash
cat /dev/null > /tmp/timezoneinfo
EMAILMESSAGE=/tmp/timezoneinfo
EMAIL=rkumar@transcomus.com
TIMEZONE=`date | awk ‘{ print $5 }’`
if [ $TIMEZONE != "GMT" ]
then
echo “Timezone on `hostname` is not GMT now” > $EMAILMESSAGE
echo “Current TImezone on the `hostname` is `date | awk ‘{ print $5 }’`” >> $EMAILMESSAGE
/usr/bin/mail -s “TimeZone Change information on `hostname`” $EMAIL < $EMAILMESSAGE
fi