11#! /bin/sh
22# Support utilities for troubleshooting Infix systems
3+
4+ # Program name for usage messages (supports being renamed by users)
5+ prognm=$( basename " $0 " )
6+
37#
48# The collect command gathers system information and outputs a tarball.
59# Data is collected to /var/lib/support (or $HOME as fallback) and then
913# systems that do not yet have this script in the root fileystems.
1014#
1115# 1. Copy this script to the target device's home directory:
12- # scp support user@device:
16+ #
17+ # scp support user@device:
1318#
1419# 2. SSH to the device and make it executable:
15- # ssh user@device
16- # chmod +x ~/ support
20+ #
21+ # ssh user@device chmod +x support
1722#
1823# 3. Run the script from your home directory:
1924#
20- # ~ /support collect > support-data.tar.gz
25+ # . /support collect > support-data.tar.gz
2126#
2227# Or directly via SSH from your workstation:
2328#
24- # ssh user@device '~ /support collect' > support-data.tar.gz
29+ # ssh user@device '. /support collect' > support-data.tar.gz
2530#
2631# Optionally, the output can be encrypted with GPG using a password for
2732# secure transmission to support personnel, see below.
2833#
2934# Examples:
30- # support collect > support-data.tar.gz
31- # support collect -s 5 > support-data.tar.gz
32- # support collect -p > support-data.tar.gz.gpg
33- # support collect -p mypass > support-data.tar.gz.gpg
35+ # ./ support collect > support-data.tar.gz
36+ # ./ support collect -s 5 > support-data.tar.gz
37+ # ./ support collect -p > support-data.tar.gz.gpg
38+ # ./ support collect -p mypass > support-data.tar.gz.gpg
3439#
35- # ssh user@device support collect > support-data.tar.gz
36- # ssh user@device support collect -p mypass > support-data.tar.gz.gpg
40+ # ssh user@device ./ support collect > support-data.tar.gz
41+ # ssh user@device ./ support collect -p mypass > support-data.tar.gz.gpg
3742#
3843# Note, interactive password prompt (-p without argument) may echo characters
3944# over SSH due to local terminal echo. Use -p PASSWORD for remote execution,
40- # or pipe the password: echo "password" | ssh user@device support collect -p
45+ # or pipe the password: echo "password" | ssh user@device ./ support collect -p
4146# meaning you can even: echo "$SECRET_VARIABLE" | ... which in some cases can
4247# come in handy.
4348#
@@ -91,7 +96,7 @@ cmd_collect()
9196 ;;
9297 * )
9398 echo " Error: Unknown option '$1 '" >&2
94- echo " Usage: support collect [--log-sec|-s N] [--password|-p PASSWORD]" >&2
99+ echo " Usage: $prognm collect [--log-sec|-s N] [--password|-p PASSWORD]" >&2
95100 exit 1
96101 ;;
97102 esac
@@ -450,7 +455,7 @@ cmd_clean()
450455 ;;
451456 * )
452457 echo " Error: Unknown option '$1 '" >&2
453- echo " Usage: support clean [--dry-run] [--days N]" >&2
458+ echo " Usage: $prognm clean [--dry-run] [--days N]" >&2
454459 exit 1
455460 ;;
456461 esac
@@ -509,7 +514,7 @@ cmd_clean()
509514
510515usage ()
511516{
512- echo " Usage: support [global-options] <command> [options]"
517+ echo " Usage: $prognm [global-options] <command> [options]"
513518 echo " "
514519 echo " Global options:"
515520 echo " -w, --work-dir PATH Use PATH as working directory for collection/cleanup"
@@ -531,14 +536,14 @@ usage()
531536 echo " -d, --days N Remove directories older than N days (default: 7)"
532537 echo " "
533538 echo " Examples:"
534- echo " support collect > support-data.tar.gz"
535- echo " support collect -p > support-data.tar.gz.gpg"
536- echo " support collect --password mypass > support-data.tar.gz.gpg"
537- echo " support --work-dir /tmp/ram collect > support-data.tar.gz"
538- echo " ssh user@device support collect > support-data.tar.gz"
539- echo " support clean --dry-run"
540- echo " support clean --days 30"
541- echo " support --work-dir /tmp/ram clean"
539+ echo " $prognm collect > support-data.tar.gz"
540+ echo " $prognm collect -p > support-data.tar.gz.gpg"
541+ echo " $prognm collect --password mypass > support-data.tar.gz.gpg"
542+ echo " $prognm --work-dir /tmp/ram collect > support-data.tar.gz"
543+ echo " ssh user@device $prognm collect > support-data.tar.gz"
544+ echo " $prognm clean --dry-run"
545+ echo " $prognm clean --days 30"
546+ echo " $prognm --work-dir /tmp/ram clean"
542547 exit 1
543548}
544549
0 commit comments