summaryrefslogtreecommitdiffstats
path: root/services/bin/services
blob: 90d3f624027aeb0ef4a408ba0858ea40bbcc0d0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /bin/sh
# usage: services [user@]hostname[:port]
set -euf

user=services
hostname=${1-localhost}
port=1337

if echo $hostname | grep -q @; then
  user=`echo $hostname | cut -d@ -f1`
  hostname=`echo $hostname | cut -d@ -f2`
fi
if echo $hostname | grep -q :; then
  port=`echo $hostname | cut -d: -f2`
  hostname=`echo $hostname | cut -d: -f1`
fi

ssh $user@$hostname -p $port