Skip to content

Commit

Permalink
Log
Browse files Browse the repository at this point in the history
  • Loading branch information
za3k committed Jan 25, 2024
1 parent 60b5853 commit 80d57e3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions log
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
usage() {
echo "Usage: log DATASET" >>/dev/stderr
}
if [ $# -gt 1 ]; then
echo "Too many arguments." >>/dev/stderr
usage
exit 1
fi
if [ -z "${1}" ]; then
SERVICE=main
else
SERVICE=$1
fi
if [ -z "`echo $SERVICE | /usr/bin/tr -d '[:alnum:]_-'`" ]; then
while read x; do
DATE=`TZ=UTC /bin/date +"%Y-%m-%dT%H:%M:%SZ"`
if [ -e /var/log/forever ]; then
echo "$DATE [${SERVICE}] ${x}" >>/var/log/forever/${SERVICE}.log
else
echo "# mkdir /var/log/forever && chmod 1777 /var/log/forever"
fi
done
else
echo "Invalid dataset" >>/dev/stderr
usage
exit 1
fi

0 comments on commit 80d57e3

Please sign in to comment.