feat: reorganize examples and add signature support to JobBuilder
- Reorganized examples into osiris/, sal/, and utils/ folders - Moved hardcoded scripts to separate .rhai files - Added signature() method to JobBuilder for job signing - Updated OSIRIS context to use block_in_place instead of runtime - Removed runtime field from OsirisContext - Added typed save() methods for Note and Event objects - Updated all examples to use new structure and APIs
This commit is contained in:
		
							
								
								
									
										29
									
								
								examples/sal/scripts/process/process_list.rhai
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								examples/sal/scripts/process/process_list.rhai
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
print("Listing processes using process_list()...\n");
 | 
			
		||||
 | 
			
		||||
// Example: List all processes (use empty string as pattern)
 | 
			
		||||
// print("Listing all running processes (this might be a long list!)...\n");
 | 
			
		||||
// let all_processes = process_list("");
 | 
			
		||||
// print(`Found ${all_processes.len()} total processes.`);
 | 
			
		||||
// // Optional: print details for a few processes
 | 
			
		||||
// for i in 0..min(all_processes.len(), 5) {
 | 
			
		||||
//     let proc = all_processes[i];
 | 
			
		||||
//     print(`- PID: ${proc.pid}, Name: ${proc.name}, CPU: ${proc.cpu}%, Memory: ${proc.memory}`);
 | 
			
		||||
// }
 | 
			
		||||
 | 
			
		||||
print("Listing processes matching 'bash'...\n");
 | 
			
		||||
 | 
			
		||||
// Example: List processes matching a pattern
 | 
			
		||||
let pattern_to_list = "bash"; // Or another common process like "SystemSettings" or "Finder" on macOS, "explorer.exe" on Windows, "systemd" on Linux
 | 
			
		||||
let matching_processes = process_list(pattern_to_list); // Halts on OS error during list attempt
 | 
			
		||||
 | 
			
		||||
if (matching_processes.len() > 0) {
 | 
			
		||||
    print(`Found ${matching_processes.len()} processes matching '${pattern_to_list}':`);
 | 
			
		||||
    for proc in matching_processes {
 | 
			
		||||
        // Access properties of the ProcessInfo object
 | 
			
		||||
        print(`- PID: ${proc.pid}, Name: ${proc.name}, CPU: ${proc.cpu}%, Memory: ${proc.memory}`);
 | 
			
		||||
    }
 | 
			
		||||
} else {
 | 
			
		||||
    print(`No processes found matching '${pattern_to_list}'.`);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print("\nprocess_list() example finished.");
 | 
			
		||||
		Reference in New Issue
	
	Block a user