Created
September 3, 2013 07:38
-
-
Save fkei/6420759 to your computer and use it in GitHub Desktop.
bash and make memo #1
This file contains hidden or 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
OSがLinuxかチェック | |
# -- | |
[ "x`uname -s`" != "xLinux" ] && echo "For Linux OS.\t[ NG ]" && exit 1 | |
rootユーザかチェック | |
# -- | |
[ "x`whoami`" != "xroot" ] && echo "Only root can run." && exit 1 | |
runuserで実行する | |
# -- | |
__runuser=`which runuser` | |
USER=hoge | |
__python=`which python` | |
PROG_BIN=application.py | |
OPTS="-c conf/application.json" | |
LOG_FILE="/var/log/application.log" | |
${__runuser} -s /bin/bash - ${USER} -c "${__python} ${PROG_BIN} ${OPTS} >>${LOG_FILE} 2>&1" | |
Makefileで特定ファイル、フォルダを強制削除(.DS_Store || .git) | |
# -- | |
TARGET_DIR="./target" | |
clean: | |
rm -rf `find $(TARGET_DIR) -type f -name .DS_Store ! -regex \.DS_Store/. -print` | |
rm -rf `find $(TARGET_DIR) -type d -name .git ! -regex \.git/. -print` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment