Linux Tip: (commands over ssh)

Discount Hockey Jerseys China, Discount NFL Jerseys China jerseysuperb

I have a freenas box and I like to periodically check the smart status on my drives to make sure everything’s OK. I just figured out a really sweet way to do it without lifting a finger.

You can run commands though SSH by using ' around the commands.

 


For example to get the smart status on one of my drives I would go like this.

ssh -l root 192.168.0.121 'smartctl -a /dev/ad0'

This will output the results of the command on my terminal.

I can take this a step further by writing the results to a file like this

ssh -l root 192.168.0.121 'smartctl -a /dev/ad0' > /tmp/smart

This will output the results to a txt file in my tmp directory.

I then use this command in conky to display the word PASSED or FAILED on my desktop.

cat /tmp/smart |grep overall-health |cut -c51-56

I plan to actually pull reallocated sectors and drive temps from this but with the output in the tmp directory you can take whatever you want.

I can see this coming in handy for all kinds of system monitoring. I never knew you could use SSH to run commands without actually logging in. You can basiclly have a separate conky instance for multiple systems on your workstations desktop.

I'm sorry but Linux rocks, Try doing this in Windows.

Share

 

 

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.