Tidbit tip on Lasso CLI together with GeekTool

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Tidbit tip on Lasso CLI together with GeekTool

Jolle Carlestam-3
GeekTool is a cool OSX addition that will allow you to put stuff directly on your desktop background.
http://projects.tynsoe.org/en/geektool/

There are tons of scripts out there that can do a multitude of things, from dynamically change background image or displaying cool calendars to placing relevant data of different kind on the desktop.

An additional cool feature is that GeekTool can make use of Lasso CLI script files. Let you imagination flow away with ideas on how you can make use of this. It's probably just the imagination that's the limit.

Here's a tip on how to get started. Purpose to check the memory usage on a remote server. To do this you need two files.
One local on your own machine, the one GeekTool calls. And one on the remote server that the local machine can attempt to reach.

The local file looks like this:
#!/usr/bin/lasso9
include_url('https://path.to.myserver.tld/memory_check.lasso')

Note, the path on the first row is dependent on how your local Lasso install was done. If it doesn't work try running:
which lasso9
in a Terminal window. The answer you get there is the path to use.

Save the file where you want to find it. Open Terminal and navigate to the place you saved the file in. (Sub tip, you can do this by typing cd space and dragging the folder from Finder to the Terminal window.)
Set the executable flag of the file. There are several ways to skin that mammal, I use:
sudo chmod ugo+x filename.lasso

The remote file, to place on the target server, can look like this:
<?Lasso
'Memory check ' + server_name + '\n'
protect
        var(memcheck = os_process('/usr/bin/free', (:'-m')))
        $memcheck->read
        $memcheck->close
/protect
?>

Before adding this to geekTool it could be a good idea to check that it works.
In Terminal run the local file you created:
./filename.lasso

The result should look something like this:
Memory check path.to.myserver.tld
             total       used       free     shared    buffers     cached
Mem:          4096       1866       2229          0        196        879
-/+ buffers/cache:        790       3305
Swap:         6111          0       6111

If it does you can turn your attention to GeekTool
Create a new geeklet by dragging the Shell icon to the desired place on the desktop. Call it something relevant for you. Set the Command field to the full path to the local Lasso file. Set refresh to 60 seconds and Timeout to 5 seconds. (Or whatever suits your needs.)
This will call the file every 60 seconds and wait for 5 seconds before indicating a failure.
Check Display the status feedback image. If you like, change the default font and color settings.
And... You're done.
The result of your effort should be a display of your memory usage directly on the desktop. If the time for returning the result from the server takes more than 5 seconds a red dot will indicate that something is wrong.

Now start using your imagination to create far more wonderful uses of GeekTool and Lasso 9 CLI than this.

HDB
Jolle
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Tidbit tip on Lasso CLI together with GeekTool

Steve Upton

On Jan 23, 2012, at 5:34 AM, Jolle Carlestam wrote:

> GeekTool is a cool OSX addition that will allow you to put stuff directly on your desktop background.
> http://projects.tynsoe.org/en/geektool/
>
> There are tons of scripts out there that can do a multitude of things, from dynamically change background image or displaying cool calendars to placing relevant data of different kind on the desktop.
>
> An additional cool feature is that GeekTool can make use of Lasso CLI script files. Let you imagination flow away with ideas on how you can make use of this. It's probably just the imagination that's the limit.
>
> Here's a tip on how to get started. Purpose to check the memory usage on a remote server. To do this you need two files.
> One local on your own machine, the one GeekTool calls. And one on the remote server that the local machine can attempt to reach.
>
> The local file looks like this:
> #!/usr/bin/lasso9
> include_url('https://path.to.myserver.tld/memory_check.lasso')
>
> Note, the path on the first row is dependent on how your local Lasso install was done. If it doesn't work try running:
> which lasso9
> in a Terminal window. The answer you get there is the path to use.
>
> Save the file where you want to find it. Open Terminal and navigate to the place you saved the file in. (Sub tip, you can do this by typing cd space and dragging the folder from Finder to the Terminal window.)
> Set the executable flag of the file. There are several ways to skin that mammal, I use:
> sudo chmod ugo+x filename.lasso
>
> The remote file, to place on the target server, can look like this:
> <?Lasso
> 'Memory check ' + server_name + '\n'
> protect
> var(memcheck = os_process('/usr/bin/free', (:'-m')))
> $memcheck->read
> $memcheck->close
> /protect
> ?>

This is interesting but I have one question. Does this have any requirement for Lasso CLI? It seems like setting up a Lasso file on the server & the querying it via a URL can be done with any version of Lasso… no?

regards,

Steve Upton

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Tidbit tip on Lasso CLI together with GeekTool

Marc Vos
Yes, but not as a shell script. That is only possible with L9.

- -
Marc


On 24 jan. 2012, at 08:23, Steve Upton wrote:

>
> On Jan 23, 2012, at 5:34 AM, Jolle Carlestam wrote:
>
>> GeekTool is a cool OSX addition that will allow you to put stuff directly on your desktop background.
>> http://projects.tynsoe.org/en/geektool/
>>
>> There are tons of scripts out there that can do a multitude of things, from dynamically change background image or displaying cool calendars to placing relevant data of different kind on the desktop.
>>
>> An additional cool feature is that GeekTool can make use of Lasso CLI script files. Let you imagination flow away with ideas on how you can make use of this. It's probably just the imagination that's the limit.
>>
>> Here's a tip on how to get started. Purpose to check the memory usage on a remote server. To do this you need two files.
>> One local on your own machine, the one GeekTool calls. And one on the remote server that the local machine can attempt to reach.
>>
>> The local file looks like this:
>> #!/usr/bin/lasso9
>> include_url('https://path.to.myserver.tld/memory_check.lasso')
>>
>> Note, the path on the first row is dependent on how your local Lasso install was done. If it doesn't work try running:
>> which lasso9
>> in a Terminal window. The answer you get there is the path to use.
>>
>> Save the file where you want to find it. Open Terminal and navigate to the place you saved the file in. (Sub tip, you can do this by typing cd space and dragging the folder from Finder to the Terminal window.)
>> Set the executable flag of the file. There are several ways to skin that mammal, I use:
>> sudo chmod ugo+x filename.lasso
>>
>> The remote file, to place on the target server, can look like this:
>> <?Lasso
>> 'Memory check ' + server_name + '\n'
>> protect
>> var(memcheck = os_process('/usr/bin/free', (:'-m')))
>> $memcheck->read
>> $memcheck->close
>> /protect
>> ?>
>
> This is interesting but I have one question. Does this have any requirement for Lasso CLI? It seems like setting up a Lasso file on the server & the querying it via a URL can be done with any version of Lasso… no?
>
> regards,
>
> Steve Upton
>
> #############################################################
> This message is sent to you because you are subscribed to
>  the mailing list Lasso
> [hidden email]
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Tidbit tip on Lasso CLI together with GeekTool

Jolle Carlestam-3
In reply to this post by Steve Upton
24 jan 2012 kl. 08:23 skrev Steve Upton:

>
> On Jan 23, 2012, at 5:34 AM, Jolle Carlestam wrote:
>
>> GeekTool is a cool OSX addition that will allow you to put stuff directly on your desktop background.
>> http://projects.tynsoe.org/en/geektool/
>>
>> There are tons of scripts out there that can do a multitude of things, from dynamically change background image or displaying cool calendars to placing relevant data of different kind on the desktop.
>>
>> An additional cool feature is that GeekTool can make use of Lasso CLI script files. Let you imagination flow away with ideas on how you can make use of this. It's probably just the imagination that's the limit.
>>
>
> This is interesting but I have one question. Does this have any requirement for Lasso CLI? It seems like setting up a Lasso file on the server & the querying it via a URL can be done with any version of Lasso… no?

The remote file is accessed using plain old include_url and can be called in a web browser as well. But to use GeekTool on your local machine you need a shell script that GeekTool can call. And thus Lasso 9.

In fact GeekTool can be set up to call a remote server using ssh and a shell script on the server thus bypassing any web handling. There are examples of that in the vast GeekTool snippet world. I just found it easier for my purpose and the demo to use include_url.

HDB
Jolle
#############################################################
This message is sent to you because you are subscribed to
  the mailing list Lasso
[hidden email]
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>