Created
July 12, 2018 13:41
-
-
Save etenzy/a47768f6d5901ada67f7e45f25fe9733 to your computer and use it in GitHub Desktop.
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
| function horizon() { | |
| dir=${PWD} | |
| case "$1" in | |
| "start") | |
| if [[ $(ps aux | grep "php $dir/artisan horizon" | grep -v grep | awk '{print $2}') ]]; then | |
| echo "horizon is already running" | |
| else | |
| nohup php $dir/artisan horizon </dev/null >/dev/null 2>&1 & | |
| echo "horizon started with pid: $(ps aux | grep "php $dir/artisan horizon" | grep -v grep | awk '{print $2}')" | |
| fi | |
| ;; | |
| "stop") | |
| echo "kill $dir/artisan horizon" | |
| kill $(ps aux | grep "php $dir/artisan horizon" | grep -v grep | awk '{print $2}') | |
| ;; | |
| "status") | |
| ps aux | grep "artisan horizon$" | grep -v grep | |
| ;; | |
| *) | |
| echo "Usage: horizon {start|stop|status}" | |
| ;; | |
| esac | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment