How to download a range of files with Curl and Bash
This is a really simple sniped how to download a range of files.
I found this very useful to download an image range of my old avatar script.
I lost my images but remembered an url where I uploaded them once. Happy me
1 2 3 4 5 6 7 | #!/usr/local/bin/bash # Range 1 to 75 for x in {1..75} do curl -O http://my.server.com/media/images_${x}.jpg done |
How to send a message to your iPhone via Pushme.to with PHP or Bash and Curl
After having Pushme.to installed on my iPhone for over 3 months now I finally had the time to work on some scrips to make it work in different languages for use on servers that I manage.
The PHP version is the less version I use but may be handy for some people.
PHP Version:
function pushMeTo($username, $message, $signature) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'http://pushme.to/' . $username . '/'); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, 'message=' . urlencode($message) . '&signature=' . urlencode($signature)); curl_exec($curl); curl_close($curl); } pushMeTo('username', 'Hello world!', 'God');
A more used version is the commandline (Bash) version:
Bash version:
#!/bin/bash username="username" message="Hello world" signature="God" /usr/local/bin/curl -F "message=$message" -F "signature=$signature" "http://pushme.to/$username/"
I currently use these for server monitoring on FreeBSD like the GEOM Raid bay and S.M.A.R.T. status of the disks and website monitoring which works quite nice. And in case the internet connection drops I have a backup via SMS with a serial connected cellphone. So this should be quite failsafe
If you have any other language that you want to use such as Perl just let me know and I could write it for you.
I hope you find these scripts useful. Happy texting!




