File: create-log.sh

package info (click to toggle)
node-shiny-server 1.5.20.1002-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,740 kB
  • sloc: javascript: 7,112; sh: 933; cpp: 303; python: 155; makefile: 34
file content (18 lines) | stat: -rwxr-xr-x 342 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

set -e

if [ $# -ne "2" ]; then
  echo "You must provide two arguments: the name of the log file and the mode"
  exit 1;
fi

LOGDIR=$(dirname "$1")

# Create directory if necessary. Will fail if it's a file.
echo "Creating directory $LOGDIR if it doesn't exist."
mkdir -p "$LOGDIR"

# Set desired mode
touch "$1"
chmod "$2" "$1"