Skip to content

Instantly share code, notes, and snippets.

@chihchun
Last active September 24, 2015 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chihchun/764503 to your computer and use it in GitHub Desktop.
Save chihchun/764503 to your computer and use it in GitHub Desktop.
#!/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