Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A restart server shell script that daemonizes any
#!/bin/bash
server_id=`cat server.pid`
if kill -9 $server_id > /dev/null 2>&1; then
echo "Server killed" >&2
fi
# start and banground server here
./server > /dev/null 2>&1 &
echo $! > server.pid
server_id=`cat server.pid`
echo "Started server with PID $server_id"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.