- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: need a scrript
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-14-2008 02:32 AM
тАО11-14-2008 02:32 AM
1, add the "used" and "cached" values(from the output of 'free'), and then email the value to admin@mynetworks.local
2, System Reboot instances should be reported(via email) to the sys admin, each system should be configured such that on startup it sends a notification to the System admin with following minimum details
a, Server Name and IP
b, Startup Date and Time
3, Through an automated script generate list of users files(/home/*) which fall under unauthorized or suspicious catagory. This includes but not limited to AVI, MP3, JPEG, TIF. All users found with such files should be notified(via email), also a notification should also be sent to the system admin and HR.
please help me meet the above requirements of our Auditors.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-14-2008 02:40 AM
тАО11-14-2008 02:40 AM
Re: need a scrript
4, check whether the time synchronization is correct with the NTP Server, if time difference is more then 1 minute an email is sent to sysadmin with details.
Thanks in anticipation
Regards
Maaz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-14-2008 05:47 AM
тАО11-14-2008 05:47 AM
Re: need a scrript
free -m | grep Mem | awk 'TOT=$3+$6 { print TOT }' | mail -s "Memory report" admin@mynetworks.local
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-14-2008 05:54 AM
тАО11-14-2008 05:54 AM
SolutionCreate a script like this:
#!/bin/bash
DEVICE=eth0
HOSTNAME=$(hostname)
IP=$(ifconfig eth0 | grep "inet addr" | awk '{print $2}' | sed 's/addr://')
DATE=$(date)
echo "$HOSTNAME ($IP) booted at $DATE" | mail -s "$HOSTANME boot" admin@mynetworks.local
And add to /etc/rc.local.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2008 06:01 AM
тАО11-19-2008 06:01 AM
Re: need a scrript
the only problem(I noticed) with this script is that I have to configure all the ntp clients for "password less ssh login" on the ntp server(ssh server)
#!/bin/bash
# timezone of the local network
export zone=UZT
export script=ntp_script@xyz.local
# sys admin email address
export sysadmin=abc@xyz.local
# ldate, lmonth, lyear, lhour, lminute, lzone are client's date, month, year etc
export ldate=$(date +%d)
export lmonth=$(date +%m)
export lyear=$(date +%Y)
export lhour=$(date +%k)
export lminute=$(date +%M)
export lzone=$(date +%Z)
# sdate, smonth, syear, shour, sminute, szone are the NTP Server's date, month, year etc
# ntp server ip = 192.168.0.1
export sdate=$(ssh 192.168.0.1 "date +%d")
export smonth=$(ssh 192.168.0.1 "date +%m")
export syear=$(ssh 192.168.0.1 "date +%Y")
export shour=$(ssh 192.168.0.1 "date +%k")
export sminute=$(ssh 192.168.0.1 "date +%M")
export szone=$(ssh 192.168.0.1 "date +%Z")
if [ $ldate -eq $sdate -a $lmonth -eq $smonth -a $lyear -eq $syear -a $lzone = $szone ]; then
echo "date, month, year and timezone are OK"
exit
fi
if [ $lzone != $szone -a $szone = $zone ]; then
cp /etc/localtime /tmp
rm -f /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Tashkent /etc/localtime
/etc/init.d/ntp stop; sleep 3;
ntpdate 192.168.0.1 && ntpdate 192.168.0.1 && ntpdate 192.168.0.1
/etc/init.d/ntp start;
# inform the admin via email
echo "client timezone was not right, issue resolved" |mail -s "NTP issue fixed" -r $script $sysadmin <~
exit
else if [ $szone != $zone ]; then
echo "NTP Server timezone is not correct" |mail -s "NTP Server Timezone wrong" -r $script $sysadmin <~
exit
fi
fi
if [ $ldate -eq $sdate -a $lmonth -eq $smonth -a $lyear -eq $syear ]; then exit
else
/etc/init.d/ntp stop; sleep 3;
ntpate 192.168.0.1 && ntpdate 192.168.0.1 && ntpdate 192.168.0.1
/etc/init.d/ntp start;
echo "client date/time was not right, issue resolved" |mail -s "NTP issue fixed" -r $script $sysadmin <~
fi
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2008 06:09 AM
тАО11-19-2008 06:09 AM
Re: need a scrript
See also this script:
http://www.mattiaswikstrom.net/linux/20061102-time-offset-check-script.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2008 06:32 AM
тАО11-19-2008 06:32 AM
Re: need a scrript
> Timezone can be different but still work correctly, depending of your location.
Yes, I did this because both(client/Server) belongs to the same timezone, anyway I think timezone checking should be omitted.
and for the url, its simply great, I think I exactly need such a script that can do quite efficiently/perfectly.
Regards
Maaz