Skip to content

Instantly share code, notes, and snippets.

@marek-pietrzak-tg
Created December 9, 2014 20:53
Show Gist options
  • Save marek-pietrzak-tg/15e2ae44c4e95e0e2906 to your computer and use it in GitHub Desktop.
Save marek-pietrzak-tg/15e2ae44c4e95e0e2906 to your computer and use it in GitHub Desktop.
Runs PhantomJs in background
#!/bin/bash
echo "Running PhantomJs..."
LOGFILE=/tmp/phantomjs.log
exec 6>&1 # Link file descriptor #6 with stdout.
exec > $LOGFILE # stdout replaced with file "logfile.txt".
# ----------------------------------------------------------- #
# All output from commands in this block sent to file $LOGFILE.
/usr/local/bin/phantomjs --webdriver=4444 &
# ----------------------------------------------------------- #
exec 1>&6 6>&- # Restore stdout and close file descriptor #6.
exit 0
@selialkile
Copy link

U can use:

nohup /usr/local/bin/phantomjs --webdriver=4444 2>/dev/null &

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment