Last active
March 29, 2016 12:24
-
-
Save PieterScheffers/9532ff8cc1de91fabbdf to your computer and use it in GitHub Desktop.
Screen start stop
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
| ### Start screen session ### | |
| # http://stackoverflow.com/questions/7049252/how-to-create-a-screen-executing-given-command | |
| function exec_in_screen() { | |
| name=$1 | |
| command=$2 | |
| screen -dmS $name sh; screen -S $name -X stuff "$command\n"; | |
| } | |
| exec_in_screen "test" "ls" | |
| # start gulp watch in screen session | |
| screen -dmS gulp_watch sh; | |
| sleep 2; | |
| screen -S gulp_watch -X stuff "gulp watch\n"; | |
| screen -dmS gulp_watch sh; screen -S gulp_watch -p 0 -X stuff "gulp watch\n"; | |
| ### Stop detached screen session ### | |
| # http://stackoverflow.com/questions/1509677/kill-detached-screen-session | |
| # stop gulp watch in screen session | |
| screen -X -S gulp_watch quit | |
| screen -S gulp_watch -p 0 -X quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment