FijiDave Posted September 18, 2019 Share Posted September 18, 2019 I want to be able to get information from my servers. I have a workflow setup that already runs ssh, runs a command and exits. How do i capture the data to use it in a notification or such? I have tried reading the help and looked at others scripts but dont see anything related to the terminal. Can anyone point me in the right direction? The text will always have the same text at the beginning but different answer like diskspace or random url Link to comment
deanishe Posted September 18, 2019 Share Posted September 18, 2019 Hi @FijiDave, welcome to the forum. 2 hours ago, FijiDave said: I have tried reading the help and looked at others scripts but dont see anything related to the terminal. To be clear, what you're asking is not about the terminal, which is a GUI program in which users can run a shell (like Terminal.app or iTerm2.app). Alfred does have a Terminal Command action, but that's definitely not what you want if you're trying to capture the output. This is actually very simple to do. Add a Run Script action to your workflow with Language = /bin/bash (or /bin/zsh), and then enter your ssh command in the Script box. That's it. The output of the command will be passed as input to the next workflow element (a Post Notification output or whatever). So if you want to see the space remaining on /dev/sda of server.example.com, you would put the following in the Script box, just like you would type in your shell: ssh server.example.com df -h | grep /dev/sda | awk '{print $4}' Link to comment
FijiDave Posted September 18, 2019 Author Share Posted September 18, 2019 Wow, I totally missed that. Thank you very much now I have to correct some other scripts. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now