Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
JR Dalrymple
/
pf_interface_usage
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1f0687f9
authored
Apr 25, 2015
by
Charlie Root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grabbing arguments and the start of the error checking is in place.
parent
7cf20819
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
check_pf_interface_usage.sh
+47
-0
No files found.
check_pf_interface_usage.sh
0 → 100644
View file @
1f0687f9
#!/bin/sh
status
=
""
exitunknown
()
{
echo
"UNKNOWN -
$status
"
exit
3
}
monthlogic
()
{
}
# GET ARGS
while
getopts
r:i:w: o
do case
"
$o
"
in
r
)
resetdate
=
"
$OPTARG
"
;;
i
)
interface
=
"
$OPTARG
"
;;
w
)
warning
=
"
$OPTARG
"
;;
[
?]
)
print
>
&2
" Usage:
$0
-r date -i interface [-w warning threshold]"
\
"
\n\n\t
date should be the time you want the counters to reset"
\
"
\n\t
it will use the format <m|d>[DD]HHMM"
\
"
\n\t
so if you want to reset at the start of the month use m010000"
\
"
\n\t
or if you want to reset daily at 3:00 AM use d0300"
\
"
\n\t
warning threshold is optional and measured in bytes."
exit
1
;;
esac
done
shift
$OPTIND
-1
period
=
"
$(
echo
"
$resetdate
"
| cut
-c1
)
"
case
"
$period
"
in
m
|
M
)
monthlogic
;;
d
|
D
)
periodsecs
=
86400
;;
*
)
status
=
"You didn't specify a valid date"
exitunknown
;;
esac
ifconfig
$interface
>
/dev/null 2>&1
rc
=
$?
if
[
$rc
-ne
0
]
;
then
status
=
"The interface
$interface
isn't valid on this system."
exitunknown
fi
echo
$resetdate
echo
$warning
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment