Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Instead of running a command in terminal, is it possible to run it 'in' the menubar in the background?

To keep the firewall open within the network I am in I use curl to ping a url every 5 minutes, using watch in Terminal, but this means I need to leave Terminal open all the time. Is it possible to 'send' this to the menu bar?

share|improve this question
1  
What about a cronjob or a cronjob that executes your scripts within a shell script? –  ricbax Oct 8 '10 at 16:41
add comment

3 Answers

Not the answer to your question, but probably to your problem:

Use screen. This way you can quit Terminal and your processes keep running.

Ctrl-A Ctrl-C (create) creates new "screens" ("tabs"/"windows"), Ctrl-A Crtl-N (next) and Ctrl-A Ctrl-P (previous) cycle through them. Ctrl-A Ctrl-D (detach) exits screen.

screen -r to re-attach to a previous screen session and check the output.

share|improve this answer
add comment

I'm not sure why you need it in the menubar?

The following is a script that will loop, and hit some curl url on the loop. You need to run it in the terminal, but can close the terminal after that.

#!/bin/bash

URL=http://some.site/
LOOPTIME=280 # just under 5 minutes

(while true;
do curl -I -s -o /dev/null $URL > /dev/null;
done) &
disown

I included -I to just use HEAD, to save both yours and the server's bandwidth

share|improve this answer
add comment

Not easily. To create a menulet - I presume this is what you mean by running it in the menu bar - you would need to write some code of your own. Depending on your programming ability, and how much effort you want to put in, that may or may not be a solution.

Alternatively, you could minimise your terminal window to the dock. Depending on how visible you want the output to be, you could also run the command in the background with screen or otherwise. If you're looking for an obvious change, you could use a script that recognised this and used something like growlnotify to tell you about it.

share|improve this answer
    
Cheers. I was hoping there was a simple way to do it with Automator or something like that. I think screen would be the way to go. –  David Pearce Oct 9 '10 at 23:42
    
Thanks for the upvote spree! –  Daniel Beck Jul 4 '11 at 11:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.