Issue is that it Compares the Hours each time when the script runs
for eg., at 2:00 PM the script runs first it will store the 2012120702
and when script runs 2nd time again 2012120702 so the script will
generate the email because last hours also 2 and this time also 2
Below is the script which i tested
Code:
#!/bin/bash
set -xv
#Current Time Stamp
CURR_TS=$( date +"%Y%m%d%H" )
FILE_TS=$( cat /tmp/curr_ts.txt 2> /dev/null ) # Time stamp in file
#admin email account
ADMIN=abc@test.com
# set usage alert threshold
THRESHOLD=60
#hostname
HOSTNAME=$(hostname)
#mail client
MAIL=/bin/mail
# store all disk info here
EMAIL=""
for line in $(df -hP | egrep '^/dev/' | awk '{ print $6 "_:_" $5 }')
do
part=$(echo "$line" | awk -F"_:_" '{ print $1 }')
part_usage=$(echo "$line" | awk -F"_:_" '{ print $2 }' | cut -d'%' -f1 )
if [ $part_usage -ge $THRESHOLD -a -z "$EMAIL" ];
then
EMAIL="$(date): Running out of diskspace on $HOSTNAME\n"
EMAIL="$EMAIL\n$part ($part_usage%) >= (Threshold = $THRESHOLD%)"
elif [ $part_usage -ge $THRESHOLD ];
then
EMAIL="$EMAIL\n$part ($part_usage%) >= (Threshold = $THRESHOLD%)"
fi
done
if [ -n "$EMAIL" ] && [ "$CURR_TS" -eq "$FILE_TS" ];
then
echo -e "$EMAIL" | $MAIL -s "Alert: Partition(s) almost out of diskspace on $HOSTNAME" "$ADMIN"
else
echo $CURR_TS > /tmp/curr_ts.txt;
fi
Last edited by manju98458; 12-06-2012 at 11:11 PM..
Hi, I'm new to linux and unix, and i have couple of problems:
1) how can i limit the access for a user, for example, i created a user, and i want that this user will be able to be only in one directory, and will see only the files i want him to.
2) I have a domain name, and i want that every... (4 Replies)
Anyone know how to limit the telnet sessions on a per user basis on an HP UX Box.
I would like to limit the Maximum number of telnet seesions a user can open at any give time to around 4 or 5. I have been looking and looking and do not seem to be able to find anything on this. Any help would be... (2 Replies)
hey guys im rly new to unix. im attempting to list the 5 largest files in a directory.
so i got this far...
ls -lR | sort -r
and this lists all files by filesize, how can i limit this to only the 5 largest? (4 Replies)
I have tried limiting failed logins to three by the following method
logins -ox \ | awk -F: '($8 != "LK" && $1 != "root") { print $1 }' \ | while read logname; do
/usr/lbin/modprpw -m umaxlntr=3 "$logname"
done
/usr/lbin/modprdef -m umaxlntr=3
but it is failing on the 4th... any ideas?... (1 Reply)
Hi, I've just been trying to setup so that server1 can ssh into server2 and execute a limited set of commands only without password login. I want it also to be able to login with a password if no command given at all though (bit I'm stuck on).
I have got this almost working with authorized_keys... (1 Reply)
Hi,
I have searched the web and have come back with nothing that is satisfactory for what I require. SFTP is my corporations new file transfer standard. What I require is a method to lock down SFTP users to their directory (they may go to sub directories) while not restricting regular users. ... (2 Replies)
Hi there,
I have a Debian 5.0 server that my company uses for deployment testing. This server needs to be accessed by NOC people that have no NIX knowledge whatsoever.
I am creating a bash script for a menu-based command interface for the commands they need to run on their testing routines,... (21 Replies)
I'm looking for a way to limit connections to a Solaris 10 box from any single IP.
The problem is that I've had more experience doing this with IPTables on Linux, rather than with IPFilter, which I've found to be somewhat feature-poor.
I hope there is some way to do this using IPFilter, I've... (2 Replies)
Hi,
I have a Debian 6 machine running Postfix 2.7.1. The email server works pretty well. I discovered that any non-root user can access to the mail queue using postqueue command just like root. How can I limit this access? (1 Reply)
Discussion started by: mjdousti
1 Replies
LEARN ABOUT DEBIAN
dep3changelog
DEP3CHANGELOG(1) General Commands Manual DEP3CHANGELOG(1)NAME
dep3changelog - generate a changelog entry from a DEP3-style patch header
SYNOPSIS
dep3changelog patch [patch ...] [options] [-- [dch_options]]
DESCRIPTION
dep3changelog extracts the DEP3 patch headers from the given patch files and builds a changelog entry for each patch. If the patch author
differs from the one detected from the DEBEMAIL, NAME, DEBEMAIL, or EMAIL environment variables, "Thanks to author <email>" is added to the
changelog entry for that patch. Any bug-debian or bug-ubuntu fields are added as "Closes" to the changelog entry. The generated changelog
entries are passed to debchange as an argument along with the given dch_options.
OPTIONS --help, -h
Display a help message and exit successfully.
--version
Display version and copyright information and exit successfully.
ENVIRONMENT
DEBEMAIL, EMAIL, DEBFULLNAME, NAME
See the above description of the use of these environment variables.
AUTHOR
Steve Langasek <vorlon@debian.org>
SEE ALSO debchange(1)DEBIAN Debian Utilities DEP3CHANGELOG(1)