Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fc15f8fff7 | |||
| 59f1607812 | |||
| 4f00bccbe5 | |||
| f082adf206 | |||
|
|
9381838e4f | ||
|
|
62cdc6a67d |
12
active-users
Executable file
12
active-users
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/php
|
||||||
|
<?php
|
||||||
|
$jsonFile = '/opt/html/online.json';
|
||||||
|
|
||||||
|
$activeUsers = shell_exec("ps -eo user=,comm= | awk '$2 ~ /sshd/ {print $1}' | grep -vE 'sshd|root' | sort -u");
|
||||||
|
|
||||||
|
$activeUsersArray = array_filter(explode("\n", $activeUsers));
|
||||||
|
|
||||||
|
$activeUsersJson = json_encode($activeUsersArray, JSON_PRETTY_PRINT);
|
||||||
|
|
||||||
|
file_put_contents($jsonFile, $activeUsersJson);
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user