File: gime-status-json.sh

package info (click to toggle)
libreswan 5.2-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 81,632 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (30 lines) | stat: -rwxr-xr-x 487 bytes parent folder | download
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
#!/bin/sh

if test $# -lt 3 ; then
    cat >> /dev/stderr <<EOF

Usage:

    $0 <directory> <start_time> <details> ...

Print status.json on stdout.

EOF
    exit 1
fi

bindir=$(cd $(dirname $0) && pwd)
directory=$1 ; shift
start_time=$1 ; shift

jq --null-input \
   --arg details "$*" \
   --arg directory "${directory}" \
   --arg start_time "${start_time}" \
   '
{}
| .current_time = (now|todateiso8601)
| .start_time = $start_time
| .directory = $directory
| .details = $details
'