Exemple #1
0
void restart_torrent(void)
{
	int is_run_before = is_torrent_run();
	int is_run_after;

	stop_torrent();
	if (count_sddev_mountpoint())
		run_torrent();

	is_run_after = is_torrent_run();

	if ((is_run_after != is_run_before) && nvram_match("fw_enable_x", "1"))
		restart_firewall();
}
Exemple #2
0
void
start_usb_apps(void)
{
	int need_restart_fw = 0;

#if defined(APP_FTPD)
	run_ftp();
	if (nvram_match("ftpd_wopen", "1"))
		need_restart_fw |= is_ftp_run();
#endif
#if defined(APP_SMBD)
	run_samba();
#endif
#if defined(APP_NFSD)
	run_nfsd();
#endif
#if defined(APP_MINIDLNA)
	run_dms(0);
#endif
#if defined(APP_FIREFLY)
	run_itunes();
#endif
#if defined(APP_TRMD)
	run_torrent();
	need_restart_fw |= is_torrent_run();
#endif
#if defined(APP_ARIA)
	run_aria();
	need_restart_fw |= is_aria_run();
#endif

	if (need_restart_fw && nvram_match("fw_enable_x", "1"))
		restart_firewall();
}
Exemple #3
0
void stop_torrent(void)
{
	if (!is_torrent_support())
		return;

	if (!is_torrent_run())
		return;

	eval("/usr/bin/transmission.sh", "stop");
}
Exemple #4
0
void run_torrent(void)
{
	char *apps_name = "Transmission";
	char *link_path = "/mnt/transmission";
	char *dest_dir = "transmission";

	if (!nvram_match("trmd_enable", "1"))
		return;

	if (!is_torrent_support())
		return;

	if (is_torrent_run())
		return;

	unlink(link_path);
	if (!create_mp_link(dest_dir, link_path, 0)) {
		logmessage(apps_name, "Cannot start: please create dir \"%s\" on target volume!", dest_dir);
		return;
	}

	eval("/usr/bin/transmission.sh", "start");
}