Ejemplo n.º 1
0
/**
 * Stop a monitor
 * @param dcb Client DCB
 * @param tree Parse tree
 */
void exec_shutdown_monitor(DCB *dcb, MAXINFO_TREE *tree)
{
    char errmsg[120];
    if (tree && tree->value)
    {
        MONITOR* monitor = monitor_find(tree->value);
        if (monitor)
        {
            monitorStop(monitor);
            maxinfo_send_ok(dcb);
        }
        else
        {
            if (strlen(tree->value) > 80) // Prevent buffer overrun
            {
                tree->value[80] = 0;
            }
            sprintf(errmsg, "Invalid argument '%s'", tree->value);
            maxinfo_send_error(dcb, 0, errmsg);
        }
    }
    else
    {
        sprintf(errmsg, "Missing argument for 'SHUTDOWN MONITOR'");
        maxinfo_send_error(dcb, 0, errmsg);
    }
}
Ejemplo n.º 2
0
/**
 * Shutdown all running monitors
 */
void
monitorStopAll()
{
MONITOR	*ptr;

	spinlock_acquire(&monLock);
	ptr = allMonitors;
	while (ptr)
	{
		monitorStop(ptr);
		ptr = ptr->next;
	}
	spinlock_release(&monLock);
}
Ejemplo n.º 3
0
bool EFtpClient::setPath(const QString &_path) {
	QDir d(_path);
	if (!d.exists()) {
		d.mkpath(".");
		if (!d.exists()) return false;
	}
	monitorStop();
	path = _path;
	EFtpMonitor *mon = new EFtpMonitorInotify(this, path);
	connect(mon, SIGNAL(directoryCreated(const QString&)), this, SLOT(directoryCreated(const QString&)));
	connect(mon, SIGNAL(directoryDeleted(const QString&)), this, SLOT(directoryDeleted(const QString&)));
	connect(mon, SIGNAL(fileCreated(const QString&)), this, SLOT(fileCreated(const QString&)));
	connect(mon, SIGNAL(fileChanged(const QString&)), this, SLOT(fileChanged(const QString&)));
	connect(mon, SIGNAL(fileAttrChanged(const QString&)), this, SLOT(fileAttrChanged(const QString&)));
	connect(mon, SIGNAL(fileDeleted(const QString&)), this, SLOT(fileDeleted(const QString&)));
	connect(mon, SIGNAL(fileRename(const QString&,const QString&)), this, SLOT(fileRename(const QString&,const QString&)));
	mon->rescan();
	return true;
}
Ejemplo n.º 4
0
/**
 * Command to shutdown a running monitor
 *
 * @param dcb	The DCB to use to print messages
 * @param monitor	The monitor to shutdown
 */
static void
shutdown_monitor(DCB *dcb, MONITOR *monitor)
{
	monitorStop(monitor);
}