fitztrev / shuttle

A simple shortcut menu for macOS
http://fitztrev.github.io/shuttle/
MIT License
4.55k stars 394 forks source link

Show command result in shuttle menu bar #257

Closed georgesnow closed 5 years ago

georgesnow commented 5 years ago

is it possible to display the output a terminal command (essentially echo the result) bacK in shuttle menu bar?

I believe I had a setup once before that did this, but I have lost the config I think I had it working in.

Screen Shot 2019-03-23 at 7 57 27 AM

thshdw commented 5 years ago

Do you envision a single line of output in the menu bar? What if the output is really long like tail -f /var/log/server.log

georgesnow commented 5 years ago

yes i was tinkering with generating up status of a remote device. i had some other thoughts i was just curious if it was possible. not a deal breaker.

i was thinking like a chron job of 5 count ping every 30 minutes and you could some grep'd part of the command result:

0.0% packet loss

or

echo "Last uptime was 00:00:00"

thshdw commented 5 years ago

The next version has an option to run commands in the background using screen see #245 These commands won't open a terminal window. You could tell screen to output to a log file and then you could use something like http://lnav.org to read those logs in a terminal window. You could do this for serveral remote devices all at once and see those logs all at once. Perhaps this would be a better solution.

thshdw commented 5 years ago

Lets say you want to see the output of your remote machine's syslog on your local system you would use screen like this.

screen -d -m -S remotesyslog -L -Logfile /home/me/logs/syslogremote.log ssh -t me@remotesystem 'tail -f /var/log/syslog'

On your local system in /home/me/logs you could use http://lnav.org to read the remote systems log file.

So you have shuttle menu commands for the servers you want to monitor. Those commands ssh to your server then immediately tail the logs directory as in my example; or you can do some special command where you grep for specific content. Regardless, whatever is running in the screen session will get outputted to the log file locally.

georgesnow commented 5 years ago

Sorry for the delay in closing this. I will give this a try and close the issue