2024-02-22 00:44:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
echo "Content-type: text/html"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
. .env
|
|
|
|
|
|
|
|
|
|
|
|
instance=''
|
|
|
|
since=''
|
|
|
|
until=''
|
|
|
|
|
2024-10-16 09:41:44 +00:00
|
|
|
action="$(echo "${REQUEST_URI##*/}" | tr -d '/\;!<>?#[]()"*.' | sed 's/&/\n/g')"
|
2024-02-22 00:44:24 +00:00
|
|
|
|
|
|
|
while IFS='=' read key value ; do
|
|
|
|
case "$key" in
|
|
|
|
instance)
|
|
|
|
instance="$value"
|
|
|
|
;;
|
|
|
|
since)
|
|
|
|
since="$value"
|
|
|
|
;;
|
|
|
|
until)
|
|
|
|
until="$value"
|
|
|
|
;;
|
|
|
|
list)
|
|
|
|
docker-compose ps -a --format json
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
done < <(echo "$action")
|
|
|
|
|
|
|
|
[ -z "$instance" ] && exit 2
|
|
|
|
[ -z "$since" ] && exit 3
|
|
|
|
[ -z "$until" ] && exit 4
|
|
|
|
|
2024-10-16 09:41:44 +00:00
|
|
|
pwd
|
2024-02-22 00:44:24 +00:00
|
|
|
echo docker-compose logs --since "$since" --until "$until" "$instance"
|
2024-10-16 09:41:44 +00:00
|
|
|
docker-compose logs --since "$since" --until "$until" "$instance" 2>&1
|
2024-02-22 00:44:24 +00:00
|
|
|
if [ "$?" -ne 0 ] ; then
|
|
|
|
echo failed
|
|
|
|
fi
|
|
|
|
|