Skip to content

Instantly share code, notes, and snippets.

@leonlaser
Last active March 22, 2019 10:52
Show Gist options
  • Save leonlaser/b437c00cf8c1d547321e092abecdf8bd to your computer and use it in GitHub Desktop.
Save leonlaser/b437c00cf8c1d547321e092abecdf8bd to your computer and use it in GitHub Desktop.
[Run command in background and save pid] #bash #nohup #pid #background
#!/bin/bash
nohup $command > ${logfile:-"nohup.log"} 2>&1&
echo $! > ${pidfile:-"nohup.pid"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment