-
Notifications
You must be signed in to change notification settings - Fork 6
/
nomadctl
executable file
·65 lines (65 loc) · 2.31 KB
/
nomadctl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
nomadctld="/usr/bin/ssh -p2222 yourserver"
if [ "$1" == "" ] || [ "$1" == "help" ]; then
echo "commands:"
echo -en "\\tps <filter> (shows all/filtered nomad jobs) (<filter> is optional)\\n"
echo -en "\\tbatch <filter> (shows batch nomad jobs) (<filter> is optional)\\n"
echo -en "\\texec <execID> <command> (executes <command> in container <execID> (command default is /bin/sh)\\n"
echo -en "\\tlogs <execID> (shows last 100 stdout lines of <execID>)\\n"
echo -en "\\ttail <execID> (shows last 100 stdout lines of <execID> and keeps following them (like tail -f))\\n"
echo -en "\\tstop <jobID> (stops a nomad job with <jobID> (<jobID> is the jobname))\\n"
echo -en "\\tinspect <jobID> (inspects a nomad job with <jobID> (<jobID> is the jobname))\\n"
echo -en "\\tstatus <jobID> (shows status of a nomad job with <jobID> (<jobID> is the jobname))\\n"
echo -en "\\tdi <execID> (runs equivalent of docker inspect on container <execID>\\n"
echo -en "\\trestart <jobID> (restart a job)\\n"
echo -en "\\tpstree <filter> (shows all/filtered nomad jobs)\\n"
echo -en "\\tinfo <jobID> (shows information about all allocations of the job)\\n"
echo -en "\\t\\n"
exit
fi
if [[ "$1" =~ ^ps ]] || [ "$1" == "batch" ]; then
$nomadctld "$1" "$2"
exit
fi
if [ "$1" == "exec" ] || [ "$1" == "attach" ]; then
if [ "$2" == "" ]; then
echo "need: execID"
exit
fi
$nomadctld -t "$@"
exit
fi
if [ "$1" == "logs" ]; then
if [ "$2" == "" ]; then
echo "need: execID"
exit
fi
$nomadctld "$1" "$2"
exit
fi
if [ "$1" == "tail" ]; then
if [ "$2" == "" ]; then
echo "need: execID"
exit
fi
$nomadctld "$1" "$2"
exit
fi
if [ "$1" == "stop" ]; then
if [ "$2" == "" ]; then
echo "need: jobID"
exit
fi
$nomadctld -t "$1" "$2"
exit
fi
if [ "$1" == "inspect" ]; then
if [ "$2" == "" ]; then
echo "need: jobID"
exit
fi
$nomadctld "$1" "$2"
exit
fi
$nomadctld "$@"
#echo Invalid command "$1". Please run nomadctl help for more information