Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
83
Issues
83
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
a1e5bec2
Commit
a1e5bec2
authored
Jul 16, 2018
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rootfs: make the /etc/init.d/lldpd.sh looks like others init scripts
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
3d2307b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
24 deletions
+72
-24
lldpd.sh
userspace/rootfs_override/etc/init.d/lldpd.sh
+71
-24
S90lldpd.sh
userspace/rootfs_override/etc/rcS/S90lldpd.sh
+1
-0
No files found.
userspace/rootfs_override/etc/init.d/lldpd.sh
View file @
a1e5bec2
...
...
@@ -3,33 +3,80 @@
# Controls lldpd.
#
CONFIG
=
/etc/lldpd.conf
LLDP
=
/usr/sbin/lldpd
OPT
=
-x
case
$1
in
start
)
printf
"Creating lldpd config: "
echo
"configure system hostname '
$(
hostname
)
'"
>
$CONFIG
echo
"configure system description 'WR-SWITCH:
$(
/wr/bin/wrsw_version
)
'"
>>
$CONFIG
echo
"resume"
>>
$CONFIG
printf
"Starting lldpd: "
start-stop-daemon
-S
-q
-p
/var/run/lldpd.pid
-x
$LLDP
--
$OPT
[
$?
=
0
]
&&
echo
"OK"
||
echo
"FAIL"
LLDPD_CONFIG
=
/etc/lldpd.conf
LLDPD
=
/usr/sbin/lldpd
# -x -- Enable SNMP subagent.
LLDPD_OPT
=
-x
dotconfig
=
/wr/etc/dot-config
start_counter
()
{
# increase start counter
COUNTER_FILE
=
"/tmp/start_cnt_lldpd"
START_COUNTER
=
1
if
[
-f
"
$COUNTER_FILE
"
]
;
then
read
-r
START_COUNTER <
$COUNTER_FILE
START_COUNTER
=
$((
START_COUNTER+1
))
fi
echo
"
$START_COUNTER
"
>
$COUNTER_FILE
}
start
()
{
echo
-n
"Creating lldpd config: "
echo
"configure system hostname '
$(
hostname
)
'"
>
$LLDPD_CONFIG
echo
"configure system description 'WR-SWITCH:
$(
/wr/bin/wrsw_version
)
'"
>>
$LLDPD_CONFIG
echo
"resume"
>>
$LLDPD_CONFIG
echo
-n
"Starting lldpd: "
# if [ -f $dotconfig ]; then
# . $dotconfig
# else
# echo "$0 unable to source dot-config ($dotconfig)!"
# fi
#
start-stop-daemon
-S
-q
-p
/var/run/lldpd.pid
--exec
$LLDPD
--
$LLDPD_OPT
ret
=
$?
if
[
$ret
-eq
0
]
;
then
start_counter
echo
"OK"
elif
[
$ret
-eq
1
]
;
then
echo
"Failed (already running?)"
else
echo
"Failed"
fi
}
stop
()
{
echo
-n
"Stopping lldpd: "
start-stop-daemon
-K
-q
-p
/var/run/lldpd.pid
if
[
$?
-eq
0
]
;
then
echo
"OK"
else
echo
"Failed"
fi
}
restart
()
{
stop
start
}
case
"
$1
"
in
start
)
start
;;
stop
)
printf
"Stopping lldpd: "
start-stop-daemon
-K
-q
-p
/var/run/lldpd.pid
[
$?
=
0
]
&&
echo
"OK"
||
echo
"FAIL"
stop
)
stop
;;
restart
)
$0
stop
$0
start
restart|reload
)
restart
;;
*
)
echo
"Usage:
$0
{start|stop|restart}"
*
)
echo
$
"Usage:
$0
{start|stop|restart}"
exit
1
;;
esac
userspace/rootfs_override/etc/rcS/S90lldpd.sh
0 → 120000
View file @
a1e5bec2
../init.d/lldpd.sh
\ No newline at end of file
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