- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need some help with coding output.
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-21-2002 07:05 AM
08-21-2002 07:05 AM
1) I am trying to figure out the error at the bottom of this output from my script, I have coded some html in there too and i am wondering if that's the problem. Any ideas here would be good.
2) I was also wondering with the way I am doing the grep at the bottom for todays date and yesterdays date if that will work in the way its listed.
I am also attaching the script here for reviewing purposes.
mmdcux17@/home/fgrosb01# ./bpdbjobs.output
#!/usr/bin/ksh -v
#
# This script is being developed to provide a detailed report of the previous day's backup
# jobs from netbackup. This script will be executed daily at 10:00AM.
# Upon successful completion, the output from this script will be webified using html and then
# emailed to the it_backup_admins mailing list.
#
# This script must be executed utlizing the root user account.
# Environmental section
set -u
BASEDIR=/home/fgrosb01
DATE=`date +%Y%m%d`
YDATE=`expr $DATE - 1`
SCRIPT_REVISION="HPUX-b.11.00.01"
SCRIPT_HPUX_VERSION=$(uname -r)
SCRIPT_SYSTEM=$(uname - n)
SCRIPT_USER=$(whoami)
SCRIPT_EXECUTION_TIME=$(date +'%Y/%m/%d/%H:%M:%S')
MAIL=/usr/bin/mailx
ADDRESS="frank.grosberger@chsli.org"
INPUT_FILE=${BASEDIR}/${DATE}.fullnbujobsreport
TMP_FILE=${BASEDIR}/${DATE}.tmpnbujobsreport
OUTPUT_FILE=${BASEDIR}/${DATE}.nbujobsreport
echo ${SCRIPT_SYSTEM} \(Version ${SCRIPT_REVISION}\) ${SCRIPT_EXECUTION_TIME}
HP-UX (Version HPUX-b.11.00.01) 2002/08/21/10:58:36
echo _____________________________________________________________________
_____________________________________________________________________
echo
if [ ${SCRIPT_USER} != "root" ] ; then
echo
echo "This program must be executed utilizing the root logon id only"
echo
return 501
fi
echo _______________________________________________________________________
_______________________________________________________________________
###########################################################################
#
# This section of the script will execute the bpdbjobs command utilizing
# the file /home/fgrosb01/.xbpmonrcfg as it's configuration file for the
# output.
bpdbjobs -header -report -format ${BASEDIR}/.xbpmonrcfg > ${INPUT_FILE}
cat ${INPUT_FILE} | awk '{
BEGIN{
print "
print "";
print "
jobid | jobtype | client | class | schedule | server | status | started}; jobid=substr($0,1,10); jobtype=substr($0,12,11); jobstate=substr($0,24,8); status=substr($0,33,8); class=substr($0,42,27); schedule=substr($0,70,18); client=substr($0,89,26); mediaserver=substr($0,116,26); started=substr($0,143,21); elapsed=substr($0,165,14); ended=substr($0,180,21) Kbytes=substr($0,202,13); files=substr($0,216,13); compestimated=substr($0,230,11); printf(" | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s |
print ""
' >${TMP_FILE}
syntax error The source line is 2.
The error context is
>>> BEGIN <<< {
awk: The statement cannot be correctly parsed.
The source line is 2.
syntax error The source line is 21.
awk: There is a missing } character.
cat ${TMP_FILE} | grep -e ${DATE} -e ${YDATE} > ${OUTPUT_FILE}
cat ${OUTPUT_FILE} | $MAIL -s "Netbackup Jobs Report ${SCRIPT_EXECUTION_TIME}" $ADDRESS
Null message body; hope that's ok
exit 0
mmdcux17@/home/fgrosb01#
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 07:10 AM
08-21-2002 07:10 AM
Solutioncat ${INPUT_FILE} | awk '{
BEGIN{
print "
print "";
print "
jobid | jobtype | client | class | schedule | server | status | started}; jobid=substr($0,1,10); should be- cat ${INPUT_FILE} | awk 'BEGIN{ print " print ""; print "
|
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 07:11 AM
08-21-2002 07:11 AM
Re: Need some help with coding output.
You need to CLOSE your HTML
print ""
SHOULD be
print "";
AND
get rid of the FIRST {
in cat ${INPUT_FILE} | awk '{
SHOULD be
cat ${INPUT_FILE} | awk '
AND
BODY of awk should have the { to start it, as in
{jobid=substr($0,1,10);
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 07:26 AM
08-21-2002 07:26 AM
Re: Need some help with coding output.
#!/usr/bin/ksh -v
#
# This script is being developed to provide a detailed report of the previous day's backup
# jobs from netbackup. This script will be executed daily at 10:00AM.
# Upon successful completion, the output from this script will be webified using html and then
# emailed to the it_backup_admins mailing list.
#
# This script must be executed utlizing the root user account.
# Environmental section
set -u
BASEDIR=/home/fgrosb01
DATE=`date +%Y%m%d`
YDATE=`expr $DATE - 1`
SCRIPT_REVISION="HPUX-b.11.00.01"
SCRIPT_HPUX_VERSION=$(uname -r)
SCRIPT_SYSTEM=$(uname - n)
SCRIPT_USER=$(whoami)
SCRIPT_EXECUTION_TIME=$(date +'%Y/%m/%d/%H:%M:%S')
MAIL=/usr/bin/mailx
ADDRESS="frank.grosberger@chsli.org"
INPUT_FILE=${BASEDIR}/${DATE}.fullnbujobsreport
TMP_FILE=${BASEDIR}/${DATE}.tmpnbujobsreport
OUTPUT_FILE=${BASEDIR}/${DATE}.nbujobsreport
echo ${SCRIPT_SYSTEM} \(Version ${SCRIPT_REVISION}\) ${SCRIPT_EXECUTION_TIME}
HP-UX (Version HPUX-b.11.00.01) 2002/08/21/11:24:28
echo _____________________________________________________________________
_____________________________________________________________________
echo
if [ ${SCRIPT_USER} != "root" ] ; then
echo
echo "This program must be executed utilizing the root logon id only"
echo
return 501
fi
echo _______________________________________________________________________
_______________________________________________________________________
###########################################################################
#
# This section of the script will execute the bpdbjobs command utilizing
# the file /home/fgrosb01/.xbpmonrcfg as it's configuration file for the
# output.
bpdbjobs -header -report -format ${BASEDIR}/.xbpmonrcfg > ${INPUT_FILE}
cat ${INPUT_FILE} | awk 'BEGIN{
print "
print "";
print "
jobid | jobtype | client | class | schedule | server | status | started}; { jobid=substr($0,1,10); jobtype=substr($0,12,11); jobstate=substr($0,24,8); status=substr($0,33,8); class=substr($0,42,27); schedule=substr($0,70,18); client=substr($0,89,26); mediaserver=substr($0,116,26); started=substr($0,143,21); elapsed=substr($0,165,14); ended=substr($0,180,21) Kbytes=substr($0,202,13); files=substr($0,216,13); compestimated=substr($0,230,11); printf(" | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s | %s |
print "";
' >${TMP_FILE}
syntax error The source line is 28.
The error context is
print ""; >>>
<<<
awk: The statement cannot be correctly parsed.
The source line is 28.
awk: There is a missing } character.
cat ${TMP_FILE} | grep -e ${DATE} -e ${YDATE} > ${OUTPUT_FILE}
cat ${OUTPUT_FILE} | $MAIL -s "Netbackup Jobs Report ${SCRIPT_EXECUTION_TIME}" $ADDRESS
Null message body; hope that's ok
exit 0
mmdcux17@/home/fgrosb01#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 07:54 AM
08-21-2002 07:54 AM
Re: Need some help with coding output.
END{
print "";
print "";
' >${TMP_FILE}
needs to be-
END{
print "";
print "";
}' >${TMP_FILE}
Additional "}" to close END.
If you use "vi" to edit this awk script, use can use "%" to help find matching "{" "}" together.
Recommend that you test each phase of the script separatelly. To verify the results of each filter get what you think you want.
My 2 cents.
-- Rod Hills