2010-09-03 18:26:59 +00:00
|
|
|
#!/usr/bin/env php
|
2009-09-07 11:07:59 +00:00
|
|
|
<?php
|
|
|
|
|
2010-02-27 14:44:38 +00:00
|
|
|
include("includes/defaults.inc.php");
|
2009-03-11 14:50:24 +00:00
|
|
|
include("config.php");
|
|
|
|
include("includes/functions.php");
|
|
|
|
|
|
|
|
# Remove a host and all related data from the system
|
|
|
|
|
2011-03-15 15:10:23 +00:00
|
|
|
if ($argv[1] && $argv[2])
|
2011-03-12 08:50:47 +00:00
|
|
|
{
|
2009-03-11 14:50:24 +00:00
|
|
|
$host = strtolower($argv[1]);
|
|
|
|
$id = getidbyname($host);
|
2011-03-15 15:10:23 +00:00
|
|
|
if ($id)
|
2011-03-12 08:50:47 +00:00
|
|
|
{
|
2011-03-27 10:21:19 +00:00
|
|
|
renamehost($id, $argv[2], 'console');
|
2009-03-11 14:50:24 +00:00
|
|
|
echo("Renamed $host\n");
|
|
|
|
} else {
|
|
|
|
echo("Host doesn't exist!\n");
|
|
|
|
}
|
2011-03-12 08:50:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo("Host Rename Tool\nUsage: ./renamehost.php <old hostname> <new hostname>\n");
|
2009-03-11 14:50:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|