Skip to content

Instantly share code, notes, and snippets.

@Hoikas
Created January 7, 2012 03:53
Show Gist options
  • Save Hoikas/1573726 to your computer and use it in GitHub Desktop.
Save Hoikas/1573726 to your computer and use it in GitHub Desktop.
<?php
define('kPidFile', '/home/dirtsand/server/ds.pid');
function ds_running()
{
// No pid file, no shard.
if (!file_exists(kPidFile)){ return false; }
// Get pid and test to see if that proc is running
$pid = file_get_contents(kPidFile);
if (file_exists('/proc/'.$pid)) { return true; }
else { return false; }
}
if (ds_running()) {
?>
Welcome to the Guild of Writers Shard!
<?php } else { ?>
The Guild of Writers Shard currently down.
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment