Skip to content

Instantly share code, notes, and snippets.

@lsongdev
Created October 2, 2015 01:49
Show Gist options
  • Select an option

  • Save lsongdev/a02fc21485cbce9c360b to your computer and use it in GitHub Desktop.

Select an option

Save lsongdev/a02fc21485cbce9c360b to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#
LOG_DIR=/var/sankuai/logs/myfe-canary
#
DATE=$(date +%F)
PID="$LOG_DIR/myfe-canary-0.pid"
#
LOG_STDOUT="$LOG_DIR/stdout.log"
LOG_STDERR="$LOG_DIR/stderr.log"
# move current log to backup .
mv $LOG_STDOUT "$LOG_DIR/stdout_$DATE.log"
mv $LOG_STDERR "$LOG_DIR/stderr_$DATE.log"
# tell pm2 process reload, and it'll create new one .
kill -s HUP `cat $PID`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment