- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: New to UNIX, need help with script
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
Forums
Discussions
Discussions
Discussions
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
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
08-10-2009 05:20 AM
08-10-2009 05:20 AM
Solved! Go to Solution.
- Tags:
- bdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 05:38 AM
08-10-2009 05:38 AM
Re: New to UNIX, need help with script
this will require more than a small change in the script. The whole concept in the script is at the moment to create the email file and check after it.
Line 33-35:
# Create the "emailfile"
echo "SEE THE FOLLOWING FILE: /tmp/"`date "+bdf%m%d%y%H"` > $emailfile
echo "" >> $emailfile
After a quick check there should be a file for every hour - or is it for every run?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 05:38 AM
08-10-2009 05:38 AM
Re: New to UNIX, need help with script
First, please post your attachment as a TEXT file and not a Microsoft Word document.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 05:43 AM
08-10-2009 05:43 AM
Re: New to UNIX, need help with script
My apologies, here it is again in Text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 06:09 AM
08-10-2009 06:09 AM
Re: New to UNIX, need help with script
The script will need some work. You might be better served by using and studying one that meets your objectives. Bill Hassell has one as an attachment in this thread :
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1100009
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 06:41 AM
08-10-2009 06:41 AM
Re: New to UNIX, need help with script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 11:33 AM
08-10-2009 11:33 AM
Re: New to UNIX, need help with script
I have been trying this all day. I get error: /usr/local/bin/diskspace.sh[391]: /home: Syntax error
IF I DON'T clear out all temp files used located on /var/tmp/diskspace
If I do clear them out, I don't get the syntax error but either way I DON'T get the e-mail notification.
Thoughts?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 12:04 PM
08-10-2009 12:04 PM
Re: New to UNIX, need help with script
However, the sendmail syntax still won't send the mail...... and the debug doesn't show anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 12:22 PM
08-10-2009 12:22 PM
Re: New to UNIX, need help with script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 01:28 PM
08-10-2009 01:28 PM
SolutionIf you don't have any HFS filesystems then delete the 'hfs' token from the '/etc/diskspace.conf' file that you should have created (see the internal instructions).
Then run the script like:
# ./diskspace.sh -e"jarheadatheart@us.org"
This gives me alerts, BUT upon rerunning, I see the behavior you noted:
...[390]:LASTVALUE + INCR: The specified number is not valid for this command.
The key appears to be to make sure that you have a 'diskspace.conf' file that has mountpoints with maximum and minimums defined, like:
/usr 90 2
...but not:
/usr 90
...despite what the documentation might suggest.
For example, this works only the first time and fails thereafter:
vxfs
25 1
/patches 26
...but this fixes the problem:
vxfs
25 1
/patches 26 1
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 02:28 PM
08-10-2009 02:28 PM
Re: New to UNIX, need help with script
A better solution to your problem may be to add a one-line patch at line-388:
...
385 # Been there before but have we exceeded to INCR value? Note: we may
386 # be at 99% so the script will repeat.
387
388 [ -z "${INCR}" ] && INCR=${DEFINCR} #...patch...
389 LASTVALUE=$(echo $BEENTHERE | awk '{print $2}')
390 if [ $((LASTVALUE + INCR)) -le $PERCENT ]
...
This resets the default increment if it isn't defined. Now you can follow the documentation for the 'diskspace.conf' layout exactly.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 06:26 AM
08-11-2009 06:26 AM
Re: New to UNIX, need help with script
/usr/local/bin/diskspace.sh -e "me@me.org"
Can I?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 06:30 AM
08-11-2009 06:30 AM
Re: New to UNIX, need help with script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 06:40 AM
08-11-2009 06:40 AM
Re: New to UNIX, need help with script
> How would I set that to a cronjob? I can't set the cron to run as
/usr/local/bin/diskspace.sh -e "me@me.org"
For example:
00,10,20,30,40,50 * * * * /usr/local/bin/diskspace.sh -e"me@me.org"
...would run the process every 10-minutes after every hour on every day of the week, etc.
There is more information in the 'crontab' manpages. You're doing fine :-)
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 06:41 AM
08-11-2009 06:41 AM
Re: New to UNIX, need help with script
/usr/local/bin/diskspace.sh -e "me@me.org"
as your command in the crontab entry.
If your scirpt has any output you may want to add
> /dev/null
to the end of the command so you don't get mailed from cron every time it runs.
If there is error output cron will still mail that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 06:51 AM
08-11-2009 06:51 AM
Re: New to UNIX, need help with script
So I can in fact run it like that. ok.
And the >/dev/null will make it only send me an e-mail if the script finds something?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 06:52 AM
08-11-2009 06:52 AM
Re: New to UNIX, need help with script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 06:54 AM
08-11-2009 06:54 AM
Re: New to UNIX, need help with script
> And the >/dev/null will make it only send me an e-mail if the script finds something?
You don't need to add that in this case. By default, 'cron' creates mail and sends it to the user's crontask _IF_ either STDOUT and/or STDERR has not been redirected (to a file).
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 06:55 AM
08-11-2009 06:55 AM
Re: New to UNIX, need help with script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2009 07:17 AM
08-11-2009 07:17 AM