Open JoshWho opened 1 year ago
@DanielnetoDotCom I question this because you setup the SSD not really sure how u have it configured with the Cache plugin
the cache is probably a symbolic link,
what folder/file is filling it up?
FYI I have the following in my servers with small drives, it helps free some space
https://github.com/WWBN/AVideo-Encoder/blob/master/install/deleteSystemdPrivate.php https://github.com/WWBN/AVideo-Encoder/blob/master/install/deleteAllQueueWithError.php
20 * * * * php /var/www/html/AVideo-Encoder1/install/deleteAllQueueWithError.php
# reboot if server usage is over 90%
30 * * * * sh -c "if [ $(df / --output='pcent' | grep -o "[0-9]*") -gt 90 ]; then /sbin/shutdown -r now; fi"
# delete old tmp files
0 1 * * * php /root/deleteEncoderOldFiles.php
<?php
//0 1 * * * php /root/deleteEncoderOldFIles.php
error_reporting(E_ALL);
function deleteDirectory($dirPath) {
if (!is_dir($dirPath)) {
return;
}
$files = array_diff(scandir($dirPath), array('.', '..'));
foreach ($files as $file) {
$filePath = $dirPath . '/' . $file;
if (is_dir($filePath)) {
deleteDirectory($filePath);
} else {
unlink($filePath);
}
}
rmdir($dirPath);
}
function deleteOldFilesAndDirs($dirPath, $olderThanInSeconds = 86400, $originalOlderThanInSeconds = 604800) {
if (!is_dir($dirPath)) {
return;
}
$now = time();
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dirPath, FilesystemIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($iterator as $file) {
$filename = $file->getFilename();
$fileAgeInSeconds = $now - $file->getMTime();
if ((strpos($filename, 'TmpFile') !== false || strpos($filename, 'thumbs_') !== false) &&
$fileAgeInSeconds >= $olderThanInSeconds) {
if ($file->isDir()) {
//deleteDirectory($file->getPathname());
exec("rm -R ".$file->getPathname());
} else {
unlink($file->getPathname());
}
} elseif (strpos($filename, 'original_') !== false && $fileAgeInSeconds >= $originalOlderThanInSeconds) {
if ($file->isDir()) {
echo "Delete dir".PHP_EOL;
//deleteDirectory($file->getPathname());
exec("rm -R ".$file->getPathname());
} else {
echo "Delete file".PHP_EOL;
unlink($file->getPathname());
}
}
}
}
$encoderPaths = array(
'/var/www/html/AVideo-Encoder/',
'/var/www/html/AVideo-Encoder1/',
'/var/www/html/AVideo-Encoder2/',
'/var/www/html/AVideo-Encoder3/',
'/var/www/html/AVideo-Encoder4/',
);
foreach ($encoderPaths as $key => $encoderPath) {
echo "{$encoderPath}".PHP_EOL;
deleteOldFilesAndDirs($encoderPath);
}
Do you see what my server is doing right now? @DanielnetoDotCom
I just rebooted it i couldn't let it stay offline
Seems fine to me
Because I rebooted it It was down for 40 minutes with a 500 error and the ssd was full again
what folder/file is filling it up?
?????
That I can never see it won't let me do anything when it is like that I have to reboot then the ssd isn't full after reboot, I am just guessing it is a temp folder since it clears after reboot.
With command line you should be able to see what is filling it up
Also you do not need to wait it crash you can check now and save a screenshot and then check again in 1 hour to see what changes
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Seems like If I do not reboot nightly this fills up and causes 500 errors in all php