HEX
Server: Apache
System: Linux server.rajbhracom.com 4.18.0-553.54.1.el8_10.x86_64 #1 SMP Tue May 27 22:49:52 EDT 2025 x86_64
User: aviaworks (1000)
PHP: 7.3.33
Disabled: NONE
Upload Files
File: //bin/backuply
#!/bin/bash

# Assume we run without the wrapper by default.
USE_CGROUP_WRAPPER=false

# Check if the --enduser_backup flag is passed.
for arg in "$@"; do
	
	# If it is, check if either cgroup v1 or v2 is available.
	if [[ "$arg" == "--enduser_backup" || "$arg" == "--enduser_restore" ]]; then
		if [[ (-f /sys/fs/cgroup/cgroup.controllers || ( -d /sys/fs/cgroup/cpu && -d /sys/fs/cgroup/memory && -d /sys/fs/cgroup/blkio )) && -f /var/backuply/conf/resource_limits_enabled ]]; then
			
			USE_CGROUP_WRAPPER=true
			
		fi
		
		# Since we found the flag, we can stop looping.
		break
	fi
done

# Use the cgroup wrapper. The wrapper itself will handle v1/v2 differences.
if [[ "$USE_CGROUP_WRAPPER" == true ]]; then
    
	/usr/local/backuply/bin/backuply-cgroup /usr/local/backuply/bin/php /usr/local/backuply/cli.php "$@"

# Run the command directly without the wrapper.
else
    /usr/local/backuply/bin/php /usr/local/backuply/cli.php "$@"
fi