Skip to content

Instantly share code, notes, and snippets.

@thomo
Created February 21, 2019 18:58
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save thomo/395e6c9365359cc36954f344b9d9e495 to your computer and use it in GitHub Desktop.
Creates necessary directories in tmpfs mount points
#!/bin/sh
### BEGIN INIT INFO
# Provides: mkdir-tmpfs
# Required-Start: mountall
# Required-Stop:
# Should-Stop:
# X-Start-Before:
# Default-Start: 1 2 3 4 5
# Default-Stop:
# Short-Description: Creates necessary directories in tmpfs mount points
# Description:
### END INIT INFO
mkdir_chown() {
DIR=$1
USR=$2
GRP=$3
mkdir -p ${DIR}
chown ${USR}:${GRP} ${DIR}
}
touch_chown() {
FILE=${1}
USR=${2}
GRP=${3}
touch ${FILE}
chown ${USR}:${GRP} ${FILE}
}
case "${1:-}" in
stop|reload|restart|force-reload)
exit 0
;;
start)
mkdir_chown "/var/log" "root" "adm"
touch_chown "/var/log/gettemperature.log" "root" "adm"
chmod 664 "/var/log/gettemperature.log"
exit 0
;;
*)
echo "Usage: ${0:-} {start|stop|status|restart|reload|force-reload}" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment