-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cli-sessions] update configuration templates, default configs
- Loading branch information
1 parent
65b07ce
commit 2539a1d
Showing
5 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Update serial console config | ||
Requires=sonic.target | ||
After=sonic.target | ||
Before=getty-pre.target | ||
StartLimitIntervalSec=0 | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/serial-config.sh | ||
|
||
[Install] | ||
WantedBy=sonic.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# generate conf file for sysrq capabilities. | ||
sonic-cfggen -d -t /usr/share/sonic/templates/sysrq-sysctl.conf.j2 > /etc/sysctl.d/95-sysrq-sysctl.conf | ||
|
||
SYSRQ_CONF=0 | ||
# update sysrq for current boot. | ||
sysrq_conf=`sonic-db-cli CONFIG_DB HGET "SERIAL_CONSOLE|POLICIES" sysrq_capabilities` | ||
if [ ${sysrq_conf} = "enabled" ]; then | ||
SYSRQ_CONF=1 | ||
fi | ||
sudo echo $SYSRQ_CONF > /proc/sys/kernel/sysrq | ||
|
||
# generate env file for profile.d to set auto-logout timeout for serial consoles. | ||
sonic-cfggen -d -t /usr/share/sonic/templates/tmout-env.sh.j2 > /etc/profile.d/tmout-env.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
############################################################################### | ||
# This file was AUTOMATICALLY GENERATED. DO NOT MODIFY. | ||
# Controlled by cli-sesisons.sh | ||
############################################################################### | ||
{% set sysrq = 0 %} | ||
{% set serial_policies = (SERIAL_CONSOLE | d({})).get('POLICIES', {}) -%} | ||
{% if serial_policies.sysrq_capabilities == 'enabled' %} | ||
{% set sysrq = 1 %} | ||
{% endif %} | ||
kernel.sysrq={{ sysrq }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{# Default timeout (15 min) #} | ||
{% set inactivity_timeout_sec = 900 %} | ||
|
||
{% set serial_pol = (SERIAL_CONSOLE | d({})).get('POLICIES', {}) -%} | ||
{% if serial_pol and serial_pol.inactivity_timeout and serial_pol.inactivity_timeout | int >= 0 %} | ||
{% set inactivity_timeout_sec = serial_pol.inactivity_timeout | int * 60 %} | ||
{% endif %} | ||
|
||
{# apply only for serial tty #} | ||
tty | grep -q tty && \ | ||
export TMOUT={{ inactivity_timeout_sec }} |