Skip to content

Instantly share code, notes, and snippets.

@fkei
Created September 3, 2013 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkei/6420759 to your computer and use it in GitHub Desktop.
Save fkei/6420759 to your computer and use it in GitHub Desktop.
bash and make memo #1
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