Skip to content

Instantly share code, notes, and snippets.

@chihchun chihchun/kermit.sh
Last active Sep 24, 2015

Embed
What would you like to do?
#!/bin/sh
# A script for access console and log the output.
# A script for access console and log the output.
# Usage:
# $ DEVICE=/dev/ttyUSB0 SPEED=51200 kermit.sh
#
# Copyright (c) Rex Tsai <chihchun@kalug.linux.org.tw>
# $Id: $
# SPEED=9600
# SPEED=38400
# SPEED=115200
CFGFILE=$(mktemp /tmp/kermit-cfg.XXXXXX)
LOGFILE=$(mktemp /tmp/kermit-log.XXXXXX)
cat > ${CFGFILE} <<EOF
log session ${LOGFILE}
set line ${DEVICE:=/dev/ttyUSB0}
set speed ${SPEED:=115200}
set parity none
set carrier-watch off
set flow-control auto
set serial 8n1
robust
set protocol zmodem
connect
quit
EOF
/usr/bin/kermit ${CFGFILE}
# we don't need to config file anymore,
# since it's created dynamicly.
rm ${CFGFILE}
# After you quit kermit by Ctrl-\ + Ctrl-C (defalut seeting)
# We tell the user which file is the log file.
echo "Session Log file: ${LOGFILE}"
# rm ${LOGFILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.