Created
February 21, 2019 18:58
Star
You must be signed in to star a gist
Creates necessary directories in tmpfs mount points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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