| "._('Slots').": | ".cache_slots($off,$pool,_var($Cache[$pool],'devicesSb'),_var($Cache[$pool],'slots',0))."";
$zfsPool = strstr(_var($Cache[$pool],'fsType'),'zfs') && !isSubpool($pool);
diff --git a/emhttp/plugins/dynamix/scripts/ext_check b/emhttp/plugins/dynamix/scripts/ext_check
new file mode 100755
index 000000000..8e4a85064
--- /dev/null
+++ b/emhttp/plugins/dynamix/scripts/ext_check
@@ -0,0 +1,96 @@
+#!/bin/bash
+# ext_check start
+# ext_check status
+# ext_check cancel
+
+# Exit codes:
+# 0 - No corruption detected or process not found.
+# 1 - Corruption detected.
+# 4 - File system corruption fixed.
+# 8 - No check has been run yet.
+# 9 - Process is still running.
+
+# Using /var/lib because that's where btrfs puts status
+mkdir -p /var/lib/ext
+
+case "$1" in
+'start')
+ # Start the e2fsck process in the background and log output
+ rm -f /var/lib/ext/check.status.$3
+ {
+ /sbin/e2fsck $4 $2 &> /var/lib/ext/check.status.$3
+ echo $? > /var/lib/ext/check.status.$3.exit
+ } > /dev/null 2>&1 &
+ echo $! > /var/lib/ext/check.pid.$3
+ exit 0
+ ;;
+
+'status')
+ # Check if the process is still running
+ if [ -f /var/lib/ext/check.pid.$3 ]; then
+ pid=$(cat /var/lib/ext/check.pid.$3)
+ if kill -0 $pid 2>/dev/null; then
+ # Process is running, return status and exit code 9
+ cat /var/lib/ext/check.status.$3
+ exit 9
+ else
+ # Process is not running, read the exit status if available
+ if [ -f /var/lib/ext/check.status.$3.exit ]; then
+ exit_status=$(cat /var/lib/ext/check.status.$3.exit)
+ cat /var/lib/ext/check.status.$3
+ rm -f /var/lib/ext/check.pid.$3
+ (( exit_status & 1 )) && exit 4
+ (( exit_status & 4 )) && exit 1
+ exit 0
+ else
+ # Exit status file does not exist, but return status file if available
+ if [ -f /var/lib/ext/check.status.$3 ]; then
+ cat /var/lib/ext/check.status.$3
+ fi
+ exit 8
+ fi
+ fi
+ else
+ # No PID file found, check for existing status
+ if [ -f /var/lib/ext/check.status.$3 ]; then
+ cat /var/lib/ext/check.status.$3
+ # If no exit status file, assume process completed successfully
+ if [ -f /var/lib/ext/check.status.$3.exit ]; then
+ exit_status=$(cat /var/lib/ext/check.status.$3.exit)
+ (( exit_status & 1 )) && exit 4
+ (( exit_status & 4 )) && exit 1
+ exit 0
+ else
+ exit 8
+ fi
+ else
+ # No status file found
+ echo "Not available"
+ exit 8
+ fi
+ fi
+ ;;
+
+'cancel')
+ # Cancel the e2fsck process
+ if [ -f /var/lib/ext/check.pid.$3 ]; then
+ pid=$(cat /var/lib/ext/check.pid.$3)
+ kill $pid
+ while kill -0 $pid 2>/dev/null; do
+ sleep 1
+ done
+ echo -e "\nCancelled" >> /var/lib/ext/check.status.$3
+ rm -f /var/lib/ext/check.pid.$3
+ else
+ echo "No process to cancel"
+ fi
+
+ exit 0
+ ;;
+
+*)
+ # Handle invalid commands
+ echo "Invalid command"
+ exit 0
+ ;;
+esac
diff --git a/emhttp/plugins/dynamix/scripts/xfs_check b/emhttp/plugins/dynamix/scripts/xfs_check
index 990a15f41..65f32ba2c 100755
--- a/emhttp/plugins/dynamix/scripts/xfs_check
+++ b/emhttp/plugins/dynamix/scripts/xfs_check
@@ -17,87 +17,83 @@ mkdir -p /var/lib/xfs
case "$1" in
'start')
- # Start the xfs_repair process in the background and log output
- /sbin/xfs_repair $4 $2 &> /var/lib/xfs/check.status.$3 &
- pid=$!
- echo $pid > /var/lib/xfs/check.pid.$3
-
- # Wait for xfs_repair to complete synchronously
- wait "$pid"
-
- # Capture the exit code of xfs_repair
- echo $? > /var/lib/xfs/check.status.$3.exit
-
- exit 0
+ # Start the xfs_repair process in the background and log output
+ rm -f /var/lib/xfs/check.status.$3
+ {
+ /sbin/xfs_repair $4 $2 &> /var/lib/xfs/check.status.$3
+ echo $? > /var/lib/xfs/check.status.$3.exit
+ } > /dev/null 2>&1 &
+ echo $! > /var/lib/xfs/check.pid.$3
+ exit 0
;;
'status')
- # Check if the process is still running
- if [ -f /var/lib/xfs/check.pid.$3 ]; then
- pid=$(cat /var/lib/xfs/check.pid.$3)
- if kill -0 $pid 2>/dev/null; then
- # Process is running, return status and exit code 9
- cat /var/lib/xfs/check.status.$3
- exit 9
- else
- # Process is not running, read the exit status if available
- if [ -f /var/lib/xfs/check.status.$3.exit ]; then
- exit_status=$(cat /var/lib/xfs/check.status.$3.exit)
- cat /var/lib/xfs/check.status.$3
- rm -f /var/lib/xfs/check.pid.$3
- if [[ $exit_status -eq 0 || $exit_status -eq 1 || $exit_status -eq 2 || $exit_status -eq 4 ]]; then
- exit $exit_status
- else
- exit 0
- fi
- else
- # Exit status file does not exist, but return status file if available
- if [ -f /var/lib/xfs/check.status.$3 ]; then
- cat /var/lib/xfs/check.status.$3
- fi
- exit 8
- fi
- fi
- else
- # No PID file found, check for existing status
- if [ -f /var/lib/xfs/check.status.$3 ]; then
- cat /var/lib/xfs/check.status.$3
- # If no exit status file, assume process completed successfully
- if [ -f /var/lib/xfs/check.status.$3.exit ]; then
- exit_status=$(cat /var/lib/xfs/check.status.$3.exit)
- if [[ $exit_status -eq 0 || $exit_status -eq 1 || $exit_status -eq 2 || $exit_status -eq 4 ]]; then
- exit $exit_status
- else
- exit 0
- fi
- else
- exit 8
- fi
- else
- # No status file found
- echo "Not available"
- exit 8
- fi
- fi
+ # Check if the process is still running
+ if [ -f /var/lib/xfs/check.pid.$3 ]; then
+ pid=$(cat /var/lib/xfs/check.pid.$3)
+ if kill -0 $pid 2>/dev/null; then
+ # Process is running, return status and exit code 9
+ cat /var/lib/xfs/check.status.$3
+ exit 9
+ else
+ # Process is not running, read the exit status if available
+ if [ -f /var/lib/xfs/check.status.$3.exit ]; then
+ exit_status=$(cat /var/lib/xfs/check.status.$3.exit)
+ cat /var/lib/xfs/check.status.$3
+ rm -f /var/lib/xfs/check.pid.$3
+ if [[ $exit_status -eq 0 || $exit_status -eq 1 || $exit_status -eq 2 || $exit_status -eq 4 ]]; then
+ exit $exit_status
+ else
+ exit 0
+ fi
+ else
+ # Exit status file does not exist, but return status file if available
+ if [ -f /var/lib/xfs/check.status.$3 ]; then
+ cat /var/lib/xfs/check.status.$3
+ fi
+ exit 8
+ fi
+ fi
+ else
+ # No PID file found, check for existing status
+ if [ -f /var/lib/xfs/check.status.$3 ]; then
+ cat /var/lib/xfs/check.status.$3
+ # If no exit status file, assume process completed successfully
+ if [ -f /var/lib/xfs/check.status.$3.exit ]; then
+ exit_status=$(cat /var/lib/xfs/check.status.$3.exit)
+ if [[ $exit_status -eq 0 || $exit_status -eq 1 || $exit_status -eq 2 || $exit_status -eq 4 ]]; then
+ exit $exit_status
+ else
+ exit 0
+ fi
+ else
+ exit 8
+ fi
+ else
+ # No status file found
+ echo "Not available"
+ exit 8
+ fi
+ fi
;;
'cancel')
- # Cancel the xfs_repair process
- if [ -f /var/lib/xfs/check.pid.$3 ]; then
- pid=$(cat /var/lib/xfs/check.pid.$3)
- kill $pid
- while kill -0 $pid 2>/dev/null; do
- sleep 1
- done
- echo -e "\nCancelled" >> /var/lib/xfs/check.status.$3
- rm -f /var/lib/xfs/check.pid.$3
- else
- echo "No process to cancel"
- fi
+ # Cancel the xfs_repair process
+ if [ -f /var/lib/xfs/check.pid.$3 ]; then
+ pid=$(cat /var/lib/xfs/check.pid.$3)
+ kill $pid
+ while kill -0 $pid 2>/dev/null; do
+ sleep 1
+ done
+ echo -e "\nCancelled" >> /var/lib/xfs/check.status.$3
+ rm -f /var/lib/xfs/check.pid.$3
+ else
+ echo "No process to cancel"
+ fi
- exit 0
+ exit 0
;;
*)
- # Handle invalid commands
- echo "Invalid command"
- exit 0
+ # Handle invalid commands
+ echo "Invalid command"
+ exit 0
;;
esac
|