Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created September 19, 2014 11:06
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 shigemk2/e5432b14d016f7b2bdf9 to your computer and use it in GitHub Desktop.
Save shigemk2/e5432b14d016f7b2bdf9 to your computer and use it in GitHub Desktop.
#!/bin/bash
EMACS=$HOME/bin
estart() {
echo "Starting emacs: "
emacs &
cd $EMACS && touch EMACS_PID
echo "Saving emacs's process: "
ps aux | grep emacs | grep -v grep | awk '{print $2}' > EMACS_PID
}
estop() {
echo -n "Stopping emacs: "
cd $EMACS && cat EMACS_PID | xargs kill -9
cd $EMACS && rm EMACS_PID
}
case "$1" in
start)
estart
;;
stop)
estop
;;
restart)
estop
estart
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment