aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/arpwatch.xml28
1 files changed, 15 insertions, 13 deletions
diff --git a/packages/arpwatch.xml b/packages/arpwatch.xml
index fffd5052..e09ee66e 100644
--- a/packages/arpwatch.xml
+++ b/packages/arpwatch.xml
@@ -11,6 +11,11 @@
<configfile>arpwatch.xml</configfile>
<url>/pkg_edit.php?xml=arpwatch.xml&amp;id=0</url>
</menu>
+ <service>
+ <name>arpwatch</name>
+ <rcfile>arpwatch.sh</rcfile>
+ <executable>arpwatch</executable>
+ </service>
<fields>
<field>
<fielddescr>Listening Interface</fielddescr>
@@ -27,25 +32,22 @@
conf_mount_rw();
config_lock();
global $config;
- $fout = fopen("/usr/local/etc/rc.d/arpwatch.sh","w");
- fwrite($fout, "#!/bin/sh\n\n");
- fwrite($fout, "# PACKAGE: Arpwatch\n");
- fwrite($fout, "# EXECUTABLE: arpwatch\n");
- fwrite($fout, "\n# This file was automatically generated by the pfSense\n# package management system.\n\n");
- if(isset($config['installedpackages']['arpwatch']['config'])) {
- $int = convert_friendly_interface_to_real_interface_name($config['installedpackages']['arpwatch']['config'][0]['interface']);
- fwrite($fout, "/usr/local/sbin/arpwatch -d -i " . $int . " &amp;\n\n");
- }
- chmod("/usr/local/etc/rc.d/arpwatch.sh", 0755);
- fclose($fout);
+ $int = convert_friendly_interface_to_real_interface_name($config['installedpackages']['arpwatch']['config'][0]['interface']);
+ $start = "/usr/local/sbin/arpwatch -d -i {$int} &amp;";
+ $stop = "/usr/bin/killall arpwatch";
+ write_rcfile(array(
+ "file" => "arpwatch.sh",
+ "start" => $start,
+ "stop" => $stop
+ )
+ );
+ start_service("arpwatch")
conf_mount_ro();
config_unlock();
}
</custom_php_global_functions>
<custom_add_php_command>
sync_package_arpwatch();
- mwexec("/usr/bin/killall -HUP arpwatch");
- mwexec("/usr/local/etc/rc.d/arpwatch.sh");
</custom_add_php_command>
</packagegui>