Sponsored Content
Full Discussion: Debugging Help needed
Top Forums UNIX for Beginners Questions & Answers Debugging Help needed Post 303013657 by doghouse308 on Sunday 25th of February 2018 12:04:09 PM
Old 02-25-2018
Debugging Help needed

I am VERY much a neophyte with shell scripting. I am working on the following,

"Create a script sends an email message to the user specified on the command line if any of the file
systems at more than 60% of capacity. The script should not process special file systems as /proc on
the ce.uml.edu. It should only process file systems which are either locally mounted or are mounted
via NFS."

This is my starting point:

Code:
#!/bin/bash
#  script to send an email message to the user specified on the command line if
# any of the file systems at more than 60% of capacity.

df -H | grep -vE '^Filesystem' | 'none' | awk '{ print $1 " " $5 }' | while read fsout
do
  echo "$fsout"
  partition=$(echo "$fsout" | awk '{ print $2 }' )
  usage=$(echo "$fsout" | awk '{ print $1 }' | cut -d'%' -f1)

  if [ $usage -ge 90 ]
  then
    echo "CRITICAL WARNING!!: Filesystem \"$partition\" at "$usage"% of capacity" |
    mail -s "CRITICAL WARNING!!: Filesystem \"$partition\" at "$usage"% of capacity" paul_peterson@student.uml.edu

  elif [ $usage -ge 60 ] && [ $usage -lt 90 ]
  then
    echo "Warning!!: Filesystem \"$partition\" at "$usage"% of capacity" |
    mail -s "Warning!!: Filesystem \"$partition\" at "$usage"% of capacity" paul_peterson@student.uml.edu
  fi
done

I ma getting these errors:

Code:
./fsc.sh: line 4: $'\r': command not found
./fsc.sh: line 16: syntax error near unexpected token `elif'
'/fsc.sh: line 16: `  elif [ $usage -ge 60 ] && [ $usage -lt 90 ]

Any help is greatly appreciated.


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 02-25-2018 at 01:17 PM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regarding Debugging

Hi, If we want to debug a shell script, then set -vx has to be included in the begining of the script. Just i want to know what purpose -vx is used. Thanks in advace Sarwan (2 Replies)
Discussion started by: sarwan
2 Replies

2. Programming

function debugging. help

Hi, I tried creating my version of the cat function in bash but left it and now I'm trying to make this function work, but it wouldn't. #include <sys/param.h> #include <sys/stat.h> #include <locale.h> #include <ctype.h> #include <err.h> #include <errno.h> #include <fcntl.h>... (2 Replies)
Discussion started by: sanchopansa
2 Replies

3. Programming

Semaphore debugging

I'm running one multithreaded application, in that one of my thread is waiting infinitely in a semphore. Is there a way to determine, in which semaphore the particular thread is waiting and which thread(s) is holding the semaphore. (5 Replies)
Discussion started by: ptprabu
5 Replies

4. Shell Programming and Scripting

debugging in bash!!! help needed

Hi all, Am using bash shell. Am newbie, trying to understand the debugin process of a shell script... I am unable to comprehend the control flow ,meaning from where exactly the execution of the script begins... I tried using bash-xv <scriptname> but since am new ,am finding it difficult to... (2 Replies)
Discussion started by: wrapster
2 Replies

5. Solaris

debugging

when I tried to debug my application i got the following. gdb -v GNU gdb 6.6 file is in C and Xmotiff Languages (gdb) attach 25499 Attaching to process 25499 Retry #1: Retry #2: Retry #3: Retry #4: 0xfea40b68 in ?? () (gdb) where #0 0xfea40b68 in ?? () (0 Replies)
Discussion started by: satish@123
0 Replies

6. Programming

Need some help in debugging the C-Progam.

Hi i want to debug the C program with GDB debugger. I want to debug the program by line by line. I want to debug program like as we debug the program in Turbo-C using the F8. Can any one help me? I know i have to use single stepping. But i don't know how to use it. Any help can be appreciated..... (5 Replies)
Discussion started by: ps_sach
5 Replies

7. Shell Programming and Scripting

script debugging

is there any way you can add a breakpoint in a script so you can stop on it? i have used -xv in my shebang but the script just runs and i want it to stop at a specific point in the script. appreciate any help. (1 Reply)
Discussion started by: npatwardhan
1 Replies

8. Programming

c++ debugging

hey i have a problem with a switch case in program and the debugger is messy has hell ( we use normal VI and gdb in our schoool to make it more diffiacult) any way i have a problom where for some unknown reason the debugger just skips a switch statment as if it wasent even there the rest... (2 Replies)
Discussion started by: gotenxds
2 Replies

9. Shell Programming and Scripting

Debugging functions

So here I have a simple function that I wish to debug. However, I am unable to debug the desired function even with set -o functrace enabled. Before resorting to asking this question, I had managed to find a possible solution that did not produce the desired results, which is located here. How... (5 Replies)
Discussion started by: BrandonD
5 Replies

10. Homework & Coursework Questions

Debugging Help Needed

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! I am VERY much a neophyte with shell scripting. I am working on the following, 1. The problem statement, all variables and given/known data: "Create a script sends an... (7 Replies)
Discussion started by: doghouse308
7 Replies
icapmodify(1M)															    icapmodify(1M)

NAME
icapmodify - Activate and deactivate cores. Specify system contact email address. Change Instant Capacity configuration information. Spec- ify Instant Capacity from email address. Specify system identifier. Specify temporary capacity warning period. Apply codewords. SYNOPSIS
icapmodify -c <contact_email_address> icapmodify -C <codeword> icapmodify -f <from_email_address> icapmodify -i <system_id> icapmodify -r icapmodify -w <warning_days> icapmodify -a <n> [-D] [-t] [desc[:user_name]] icapmodify -d <n> [-D] [desc[:user_name]] icapmodify -s <n> [-D] [-t] [desc[:user_name]] Obsolescent: icod_modify -c <contact_email_address> icod_modify -C <codeword> icod_modify -f <from_email_address> icod_modify -i <system_id> icod_modify -r icod_modify -w <warning_days> icod_modify -a <n> [-D] [-t] [desc[:user_name]] icod_modify -d <n> [-D] [desc[:user_name]] icod_modify -s <n> [-D] [-t] [desc[:user_name]] DESCRIPTION
Use to activate or deactivate cores, specify system contact or Instant Capacity "from" email address, apply iCAP codewords, change the sys- tem identifier, specify a warning notification period before temporary capacity expires, and change Instant Capacity configuration informa- tion. Note that the deprecated command performs identical functions to the command and is maintained for backward compatibility. For detailed information on the use of this command, activation and deactivation of Instant Capacity components, compliance, and temporary capacity, see the located at /usr/share/doc/icapUserGuide.pdf. Compliance The command does not allow activation of cores beyond the number of available core usage rights. Additional usage rights are granted through the application of either an RTU codeword or a temporary capacity codeword. In general, a complex is in a compliant state when the number of active components of a given type does not exceed the number of usage rights associated with the type of component. The one exception is that the number of active cores is allowed to exceed the number of core usage rights as long as there is a sufficient positive balance of temporary capacity. Intended Active Changes to the number of intended active cores through the use of this command are persistent (survive system reboot). The intended active number is the number of cores that the Instant Capacity software attempts to activate at system boot time. It is adjusted by use of the -a, -d, and -s options. The number of intended active cores for each partition is displayed using the command (see icapstatus(1M)). Virtual Partitions When activating or deactivating cores within virtual partitions, special considerations apply. You can use either the command or the com- mand, depending on the type of adjustment needed and the level of logging or reporting desired. For example, core assignment via the com- mand does not result in logging of the activation, email configuration change notification, or transmission of an asset report to HP. Instant Capacity has a minimum version dependency on vPars A.03.05. For versions of vPars before A.03.05, the command for activating or deactivating cores in a virtual partition fails with an error message citing the vPar version dependency. For vPars versions A.03.05 or greater, the command must be used in a virtual partition environment when you are making any adjustment to an nPartition. To adjust core assignments across virtual partitions in a single nPartition, use the command (and options) for the best coor- dination and for optimized performance. The command does not affect the intended active number for the nPartition, and it therefore cannot be used to migrate unused capacity either to or from other nPartitions. If is used to deactivate cores in a virtual partition, and they are not activated in another virtual partition, the deactivation will not free usage rights and they are held as unused capacity by the nPartition. Options and Arguments The command recognizes the following options and arguments: -a <n> Immediately activates n additional cores for this nPartition, as long as the end result does not take the complex out of compliance. This option also increases the number of intended active cores by n for the nPartition. If specified within a virtual partition, it also results in the assignment of additional cores to the local vPar. -c <contact_email_address> Sets the system contact email address. This is the email address that receives configuration change notification and exception reports. If you want multiple recipients to receive these reports, that this can be an email alias. -C <codeword> iCAP codeword application. This option allows the user to apply an iCAP codeword received from the HP Utility Pricing Solutions portal. Application of codewords only provides usage rights for Instant Capacity components; it does not acti- vate any components. This option cannot be used to apply GiCAP codewords. For details about GiCAP codewords, see icap- manage(1M). -d <n> Immediately deactivates n cores, if possible. Instant Capacity software must leave at least one core active for each con- figured cell in a partition - this is a firmware and OS requirement. That is, in a partition of 4 cells, attempts to reduce the active core count below 4 will fail. This option also reduces the number of intended active cores by n for the nPartition. If specified within a virtual partition, it deassigns the specified number of cores from the local vPar. -D Defers a core activation or deactivation until the next reboot. This option modifies the default behavior of the -d, -s, and -a options, which is to activate or deactivate cores instantly. Note: This option is not supported within a virtual partition. Deferred operations are not cumulative. If there is a pending deferred operation, a subsequent activation or deactivation request (-s, -a, or -d), deferred or not, cancels the pending deferred request and resets the values for intended active and actual active based on the request and the current value for actual active. -f <from_email_address> Set Instant Capacity "from" email address. Causes all Instant Capacity email correspondence from this system to appear to be sent from from_email_address. Specifying an empty string (" ") returns to default behavior, which is to send from the adm user on the local system. The address specified must be DNS resolvable by HP. -i <system_id> Set system identifier used during asset reporting. The default setting for the system identifier is the hostname of the Instant Capacity system. This value can be returned to the default setting by specifying an empty string (""). The sys- tem identifier is a string that users specify to help track and distinguish their systems. -r Reconcile. Activate or deactivate cores (subject to compliance limits) to bring the system to a state where the intended active number of cores are active. The -r option can also be used to undo a deferred (-D) operation, causing an immediate activation or deactivation. -w <warning days> Set temporary capacity warning period to desired number of days. If not specified, the default warning period is 15 days. The Instant Capacity software calculates when the temporary capacity expires based on the current consumption rate. When the temporary capacity balance is projected to be depleted within the warning period, a warning message is sent by email to the system contact if specified, and root. If temporary capacity is depleted and you continue to have more active cores than core usage rights across the complex, on the next reboot of any partition in the complex the software automati- cally deactivates one or more cores in order to bring the complex into a more compliant state. Instant Capacity software deactivates as many cores as is necessary to either stop consumption of temporary capacity or to bring the partition to the minimum number of required active cores. -s <n> Sets the number of active cores and the number of intended active cores to n, as long as the end result does not take the complex out of compliance. In an nPartition environment, depending on the value of n, this option works exactly as the -a option (if n is greater than the current number of active cores), or exactly as the -d option (if n is less than the cur- rent number of active cores). Specifying a value of n less than the number of cells in a partition will fail. In a vir- tual partition environment, if unused capacity is not available, this option will use the value of n as the desired number of cores to be active in the local virtual partition. If unused capacity is available, will first activate cores from unused capacity before increasing the active cores. For further details of using this option in an virtual partition environment, see the Virtual Partition and Unused Capacity sections of Chapter 4 of the located at /usr/share/doc/ica- pUserGuide.pdf. The command fails if it is unable to set the value exactly as requested. However, a failed request can still make a par- tial change to the number of intended active cores. -t Authorize use of temporary capacity. This option, combined with either the -a or the -s option, specifies that a core activation is allowed to consume temporary capacity. Temporary capacity is consumed when the number of active cores exceeds the number of core usage rights. It is no longer used when the number of active cores is decreased to no more than the number of core usage rights available to the complex. Use or -s to reduce or stop the use of temporary capacity. It is not necessary to use the -t option when using the -d option. If a previous activation via resulted in temporary capacity being consumed in a virtual partition environment, deactivating a core with a command temporarily reduces the consumption of temporary capacity. A subsequent core activation using increases consumption of temporary capacity if the activation results in more active cores than core usage rights. desc Optional description to help customers identify this configuration change. This description becomes part of the Instant Capacity logfile (var/adm/icap.log) entry documenting the activation or deactivation. This description is also contained in the configuration change notification email. user_name Optional string identifying the person performing the core activation or deactivation. This can be any ASCII string, and becomes part of the Instant Capacity logfile (/var/adm/icap.log) entry documenting the activation or deactivation. The string specified here is also contained in the configuration change notification email. UPGRADES
The command fails if the system is in a state where a software upgrade is incomplete (the software on the system has been upgraded from a version earlier than B.06.00, but an upgrade codeword issued by the HP Utility Pricing Solutions portal was not applied to the complex). The only option that can be used when the complex is in this state is the -C option, which accepts the upgrade codeword. EXTERNAL INFLUENCES
Environment Variables o LANG determines the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (begin- ning with LC_) do not specify a locale. If LANG is not set or is set to the empty string, a default of "C" is used (see lang(5)). o LC_CTYPE determines the interpretation of single- and multiple-byte characters. o LC_TIME determines the date and time strings output. o LC_MESSAGES determines the language in which messages are displayed. If any internationalization variable contains an invalid setting, icapmodify behaves as if all internationalization variables are set to C (see environ(5)). International Code Set Support Single- and multiple-byte character code sets are supported. However, input to the command must be entered using ASCII characters only. RETURN VALUE
The command exits with one of these values: 0 Command succeeded. >0 Command failed; error message sent to STDERR. FILES
/var/adm/icap.log EXAMPLES
Instantly activate one core with "Add horsepower now" as the description and "Super User" as the user name: icapmodify -a 1 "Add horsepower now:Super User" Activate two cores (deferred until the next reboot) with "Add horsepower after reboot" as the description and "Super User" as the user name: icapmodify -D -a 2 "Add horsepower after reboot:Super User" Instantly activate one core, using temporary capacity if necessary, with "Temp use of one core" as the description and "Super User" as the user name: icapmodify -t -a 1 "Temp use of one core:Super User" Instantly activate or deactivate cores to specify 8 active cores (and 8 intended active cores) with "Set active cores to 8" as the descrip- tion and "Super User" as the user name: icapmodify -s 8 "Set active cores to 8:Super User" Deactivate one core at the next reboot with "Less horsepower after reboot" as the description and "Super User" as the user name: icapmodify -D -d 1 "Less horsepower after reboot:Super User" Apply an iCAP codeword: icapmodify -C 7y5ejVS.P5CuwXu.XaTyDVP.7Tx0Mvc-J783H9b.yWT5Weu.69JPu$u.vVV685a5 Set the Instant Capacity from_email_address to admin@research.corp.com: icapmodify -f admin@research.corp.com Set the system_id to Asset_Num_234: icapmodify -i Asset_Num_234 Set the system contact email address to super_user@corp.com: icapmodify -c super_user@corp.com AUTHOR
was developed by HP. SEE ALSO
icapnotify(1M), icapstatus(1M), icapmanage(1M), icapd(1M), icap(5), vparmodify(1M). icapmodify(1M)
All times are GMT -4. The time now is 07:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy