Skip to content

Instantly share code, notes, and snippets.

@shurikk
Last active December 18, 2015 15:08
Show Gist options
  • Save shurikk/5802069 to your computer and use it in GitHub Desktop.
Save shurikk/5802069 to your computer and use it in GitHub Desktop.
detach non-daemonized application from current session with user switching
#!/bin/sh
# * script is executed by root
# * will detach from current session
su -p user <<"EOF"
/path/to/app -o option1 > /path/to/app.log 2> /path/to/app-errors.log &
echo $! > /path/to/app.pid
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment