I'm using a simple Shell-script on my Linux-server which checks, if a rsync-job is running or if any client some directories from the server via Samba. If this is the case then nothing happens, but are there no jobs and no Samba is used, than the server goes into hibernate.
Is there any simple command, which I can use to check if a ssh-connection to the server exist? I want to add this to my Shell-script, so that the server doesn't go to hibernate, if such a connection exist.
Scan the processlist for sshd:
. Established connections look something like this: sshd: <username>…
ps -A x |grep sshd |grep -v grep
should work out for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With