diff options
Diffstat (limited to 'config/cron')
-rw-r--r-- | config/cron/cron.inc | 16 | ||||
-rw-r--r-- | config/cron/cron.xml | 12 |
2 files changed, 18 insertions, 10 deletions
diff --git a/config/cron/cron.inc b/config/cron/cron.inc index 645575d9..87591e08 100644 --- a/config/cron/cron.inc +++ b/config/cron/cron.inc @@ -27,22 +27,30 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +require_once("pfsense-utils.inc"); require_once("services.inc"); +require_once("util.inc"); function cron_sync_package() { configure_cron(); // Previous package versions were "helpfully" killing cron on uninstall. // Also, need to make sure cron is running, otherwise the package is useless. - // TODO: Something like this needs to be eventually done in configure_cron() in services.inc. - if (!is_process_running("cron")) { - exec("cd /tmp && /usr/sbin/cron -s 2>/dev/null"); + // configure_cron() function in services.inc already does this check on pfSense >=2.2.5 + $pfs_version = str_replace(".", "", substr(trim(file_get_contents("/etc/version")), 0, 5)); + if ($pfs_version < 225) { + if (!is_process_running("cron")) { + exec("cd /tmp && /usr/sbin/cron -s 2>/dev/null"); + } } } function cron_install_command() { // Clean up possible lingering garbage after previous package versions unlink_if_exists("/usr/local/etc/rc.d/cron.sh"); - cron_sync_package(); +} + +function cron_deinstall_command() { + rmdir_recursive("/usr/local/www/packages/cron"); } ?> diff --git a/config/cron/cron.xml b/config/cron/cron.xml index f777faff..181a4506 100644 --- a/config/cron/cron.xml +++ b/config/cron/cron.xml @@ -41,19 +41,16 @@ /* ====================================================================================== */ ]]> </copyright> - <description>Cron</description> - <name>Cron Settings</name> - <version>0.3.1</version> - <title>Settings</title> + <name>cronsettings</name> + <version>0.3.3</version> + <title>Cron Settings</title> <include_file>/usr/local/pkg/cron.inc</include_file> <menu> <name>Cron</name> - <tooltiptext>Cron settings.</tooltiptext> <section>Services</section> <configfile>cron.xml</configfile> <url>/packages/cron/cron.php</url> </menu> - <configpath>installedpackages->package->$packagename->configuration->cron</configpath> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> <item>https://packages.pfsense.org/packages/config/cron/cron.xml</item> @@ -87,4 +84,7 @@ <custom_php_install_command> cron_install_command(); </custom_php_install_command> + <custom_php_deinstall_command> + cron_deinstall_command(); + </custom_php_deinstall_command> </packagegui> |