#!/usr/local/bin/perl
# restart.cgi
# Kill and restart the syslog process

require './syslog-lib.pl';
&ReadParse();
$access{'noedit'} && &error($text{'restart_ecannot'});
if ($config{'restart_cmd'}) {
	&system_logged("$config{'restart_cmd'} >/dev/null 2>/dev/null </dev/null");
	}
else {
	&kill_logged('TERM', $in{'pid'}) ||
		&error(&text('restart_ekill', $in{'pid'}, $!));
	sleep(2);
	if ($config{'start_cmd'}) {
		&system_logged("$config{'start_cmd'} >/dev/null 2>/dev/null </dev/null");
		}
	else {
		&system_logged("cd / ; $config{'syslogd'} >/dev/null 2>/dev/null </dev/null &");
		}
	}
&webmin_log("apply");
&redirect("");

