Closed office222 closed 6 years ago
Hiya, I had a think, and I bet the easiest is to write a wrapper script to call just the archiver part.
Auto-purge old closed tickets
, this disables the normal cron interface).class.ArchiverPlugin.php
file), line 62:private function autoPurge() {
to
public function autoPurge() {
#!/usr/bin/php
<?php
ob_start();
include_once '/path/to/osticket/main.inc.php'; // Load osTicket
ob_clean(); // ignore header's
global $ost; // for IDE
// Locate the Archive plugin from the active list:
foreach ($ost->plugins->allActive() as $plugin) {
// The archiver plugin can be identified by it's class
if ($plugin instanceof ArchiverPlugin) {
// Force to run now by setting last-run time far in the past
$plugin->getConfig()->set('last-run', -time());
// Start purging
$plugin->autoPurge(); // you made the method public right?, otherwise you'll see an error here.
}
}
0 0 1 * * web-user /path/to/script.php
Note: If the plugin is not enabled, the script will not work.
Thank you for your help.
I seem to be having a problem with cron.
/usr/local/cpanel/bin/jailshell: /home/----/public_html/----/----/include/plugins/archive/archiver-cron.php: Permission denied
0 | 0 | 26 | | | /home/----/public_html/----/----/include/plugins/archive/archiver-cron.php
Permission denied might refer to the executable bit on the script (rw- means read and write but not execute, needs the x, like rwx). If you can't set that, your cron call should be to PHP itself with the script as a parameter. It doesn't need to be publicly accessible either. Can be run safety from your home (or any other) directory instead of potentially being called by a browser.
Just googled that error, and it looks like a match: https://stackoverflow.com/questions/42354651/permission-denied-cron-job-in-cpanel
Also, I don't think that will work with the max age you've set, 9999999999 months = 833334246 calendar years, that's unlikely to match any tickets for a while.
Unless you've got some test tickets with a really (really) old timestamp, not a bad idea.
On Sat, 28 Jul. 2018, 00:47 ofice222, notifications@github.com wrote:
Thank you for your help.
I seem to be having a problem with cron.
/usr/local/cpanel/bin/jailshell: /home/----/public_html/----/----/include/plugins/archive/archiver-cron.php: Permission denied
0 | 0 | 26 | | | /home/----/public_html/----/----/include/plugins/archive/archiver-cron.php
[image: ftp-capture1] https://user-images.githubusercontent.com/32752646/43327350-2fdf574e-9189-11e8-870f-090f551ed9da.jpg [image: ftp-capture] https://user-images.githubusercontent.com/32752646/43327361-363b035e-9189-11e8-9d23-b59f350829f8.jpg [image: ftp-capture3] https://user-images.githubusercontent.com/32752646/43327366-3945f554-9189-11e8-9d00-1610dbacba55.jpg
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/clonemeagain/osticket-plugin-archiver/issues/8#issuecomment-408441292, or mute the thread https://github.com/notifications/unsubscribe-auth/AE15jyGx1c_Gd7Lw2uYisK7GesEMPc_hks5uKygQgaJpZM4Vb0Ce .
Oh, I see where you got that from, I suggested using a large number of tickets to purge as you'd be doing it once a month rather that potentially every cron. You've got it set to 1000, which might be enough depending on how many tickets you create every month.
Assuming you got it working.
Hi, thanks for checking. No, it is not running, and I can't get to it for almost a week. Thank you
Hello and thank you for the plugin. I was wondering how I might accomplish a purge either manually or at midnight on the same date each month.