Bitcoin Forum

Other => CPU/GPU Bitcoin mining hardware => Topic started by: rethaw on July 01, 2011, 07:09:21 AM



Title: Auto-notify Script for Newegg 5830s (or any other site)
Post by: rethaw on July 01, 2011, 07:09:21 AM
Newegg's auto-notify is worthless. I wrote this script that you can run on your linux miner box that will check the stock of the Sapphire 5830s (http://www.newegg.com/Product/Product.aspx?Item=N82E16814102878&cm_re=5830-_-14-102-878-_-Product) and email you with a link to the newegg page if it comes in stock.

It checks every minute. It is currently set up to use a gmail address but you can change this to work with your server.

You firstly need curl, this is an application that will handle the connection to gmail. For debian/ubuntu:

Code:
sudo apt-get install curl

Now open your favorite text editor (vi, gedit, etc.) and paste the following code:

Code:
from_address="yourname@gmail.com" # change this
to_address="yourname@gmail.com" # and this
username="yourname@gmail.com" # and this
password="yourpass" #            this too
echo -n "Checking newegg for video cards"
echo "Subject: Video card update

Go buy some video cards, hurry! http://www.newegg.com/Product/Product.aspx?Item=N82E16814102878&cm_re=5830-_-14-102-878-_-Product
" > message.txt
running=true; while $running; do
echo -n "."
sleep 1m
if [ -z "`wget -qO- http://content.newegg.com/LandingPage/ItemInfo4ProductDetail.aspx?Item=N82E16814102878 | grep "OUT OF STOCK"`" ]
then
echo "In stock! Sending an email."
curl -n --ssl-reqd --mail-from "<$from_address>" --mail-rcpt "<$to_address>" --url smtps://smtp.gmail.com:465 -T message.txt -u "$username:$password"
running=false
rm message.txt
fi
done

You will need to edit the relevant top lines to reflect your email address and password. Now save it as "check.sh".

Then, from a command prompt "cd" to the folder where it is saved and enter:

Code:
sh check.sh

OK it's checking, you should see:

Code:
Checking newegg for video cards...

Where a "." is printed every time it checks. Leave this terminal running as long as you would like to check. It will quit if the product no longer says "OUT OF STOCK". Feel free to modify this code to check for another card. If you can't figure it out I can help out with those modifications.

I am hoping those who choose to use this aren't just turning around to sell on ebay, and good luck!


Title: Re: A Real Auto-notify for Newegg 5830s
Post by: rethaw on July 01, 2011, 07:52:18 AM
Well it worked, a batch came and went.

Good luck.


Title: Re: A Real Auto-notify for Newegg 5830s
Post by: Keninishna on July 01, 2011, 10:36:40 AM
Nice!! I could use this for some other things as well.


Title: Re: A Real Auto-notify for Newegg 5830s
Post by: BkkCoins on July 01, 2011, 11:05:41 AM
Yes, nice one!

I needed one like this to also send an SMS. You inspired me to take yours and modify it.
I simplified a bit and added details for SMS using the Clickatell api.

I comment out the echo dots and msg because I run it in background using "&" so I don't keep open a console.

Code:
#!/bin/bash

url="http://content.newegg.com/LandingPage/ItemInfo4ProductDetail.aspx?Item=N82E16814102878"
txt="OUT OF STOCK"

mailsrv="smtps://smtp.gmail.com:465"
mailuser="user@gmail.com"
mailpwd="whatever"
mailmsg="Subject: NewEgg Video Cards in Stock\r\n\r\nCome and get 'em."
from="user@gmail.com"
to="user@gmail.com"

smsuser="userid"
smspwd=""
smsapi="apicode"
smsphone="phonenumber"
smsmsg="NewEgg Video Cards in Stock"

#echo "Checking newegg for video cards"
while [ -z "`wget -qO- "$url" | grep "$txt"`" ]; do
#  echo -n "."
  sleep 1m
done

if [ -n "$smspwd" ]; then
  wget "http://api.clickatell.com/http/sendmsg?user=$smsuser&password=$smspwd&api_id=$smsapi&to=$smsphone&text=$smsmsg"
fi

if [ -n "$mailpwd" ]; then
  printf "$mailmsg" | curl -n --ssl-reqd --mail-from "<$from>" --mail-rcpt "<$to>" --url "$mailsrv" -T - -u "$mailuser:$mailpwd"
fi


Title: Re: A Real Auto-notify for Newegg 5830s
Post by: rethaw on July 01, 2011, 02:42:18 PM
Gmail can send sms as well. You send to yoursmsnumber@yourcarrier.com.

Here is a list of the carrier addresses http://en.wikipedia.org/wiki/List_of_SMS_gateways (http://en.wikipedia.org/wiki/List_of_SMS_gateways).


Title: Re: A Real Auto-notify for Newegg 5830s
Post by: BkkCoins on July 01, 2011, 02:48:01 PM
Gmail can send sms as well. You send to yoursmsnumber@yourcarrier.com.

Here is a list of the carrier addresses http://en.wikipedia.org/wiki/List_of_SMS_gateways (http://en.wikipedia.org/wiki/List_of_SMS_gateways).
I'm in Thailand and after looking around this was the only one I could find that works with my carrier.
I haven't even bought credits so it just sends a promo text when I use it - but that lets me know anyway.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: Acejam on July 01, 2011, 03:45:54 PM
Way too much work. Just use nowinstock.net. It's free and amazingly quick. I've picked up all my cards using the notification emails from them for 6990's on NewEgg.

http://www.nowinstock.net/computers/videocards/amd/6990/


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: rethaw on July 01, 2011, 04:04:39 PM
Thanks for that! It seems like they don't track 5830s, you can add as a custom it seems.

I imagine this script will be a bit quicker to the draw. You can modify the polling rate to your liking.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: BkkCoins on July 01, 2011, 06:18:11 PM
Just got my SMS - Newegg has 5830s again in stock.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: rethaw on July 01, 2011, 06:21:56 PM
Wow already out again.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: BkkCoins on July 01, 2011, 06:27:19 PM
I got two in my shopping cart.
But I have no idea if they get dumped out by other orders getting paid first.

Edit: I waited too long as I had to transfer money. They got snatched away. Blah.
They stayed in my cart for about a half hour.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: bleedkira on July 01, 2011, 06:51:58 PM
They do.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: CanaryInTheMine on July 01, 2011, 07:48:29 PM
For those not using Linux, see: http://forum.bitcoin.org/index.php?topic=24552.0


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: Mousepotato on July 01, 2011, 08:39:25 PM
Way too much work. Just use nowinstock.net. It's free and amazingly quick. I've picked up all my cards using the notification emails from them for 6990's on NewEgg.

http://www.nowinstock.net/computers/videocards/amd/6990/
Is there a way to get NowInStock.net to monitor for 5830s?


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: rethaw on July 01, 2011, 10:45:02 PM
Way too much work. Just use nowinstock.net. It's free and amazingly quick. I've picked up all my cards using the notification emails from them for 6990's on NewEgg.

http://www.nowinstock.net/computers/videocards/amd/6990/
Is there a way to get NowInStock.net to monitor for 5830s?

I set notifications for every site selling a 5850 or 5870. I haven't heard yet.

That being said I know the script I posted works and it can be modified to work with any page. Friend of mine picked up 2 5830s today.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: IlbiStarz on July 03, 2011, 05:57:00 AM
Do you also change the stuff in

curl -n --ssl-reqd --mail-from "<$from_address>" --mail-rcpt "<$to_address>" --url smtps://smtp.gmail.com:465 -T message.txt -u "$username:$password"

or only the stuff in the top? Can you also double that line to send 2 emails?


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: rethaw on July 03, 2011, 06:02:21 AM
If you're using gmail you don't have to change anything on that line. For another email server, yes, that is the only line you need to change. The changes that need to be made will depend on your specific service.

If you double that line you will need to enter a different to address in place of $to_address. It will allow you to send multiple emails.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 26, 2012, 08:34:24 PM
how can I get this to work on windows?>


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: chungenhung on January 27, 2012, 12:53:25 AM
how can I get this to work on windows?>
it runs in linux.
you can install linux on a virtual machine, then you would be able to run it.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 01:04:47 AM
how can I get this to work on windows?>
it runs in linux.
you can install linux on a virtual machine, then you would be able to run it.

will it work on ubuntu?


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: Eveofwar on January 27, 2012, 01:05:33 AM
how can I get this to work on windows?>
it runs in linux.
you can install linux on a virtual machine, then you would be able to run it.

will it work on ubuntu?


Yes, Ubuntu is linux.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 02:37:56 AM
how do I install curl?


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: Eveofwar on January 27, 2012, 02:39:11 AM
how do I install curl?

http://bit.ly/wu0IWY


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 02:49:24 AM
how do I install curl?

http://bit.ly/wu0IWY

first time using ubuntu don't be a dick.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: Eveofwar on January 27, 2012, 02:50:09 AM
how do I install curl?

http://bit.ly/wu0IWY

first time using ubuntu don't be a dick.

First time using the internet, can't do your own research too ?

Give me a break.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 02:53:14 AM
I typed in:


sudo apt-get install curl


and it gave me this: (is it installed?)

Quote
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libcurl3
The following NEW packages will be installed:
  curl libcurl3
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 369 kB of archives.
After this operation, 987 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main libcurl3 i386 7.21.6-3ubuntu3.2 [236 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main curl i386 7.21.6-3ubuntu3.2 [134 kB]
Fetched 369 kB in 1s (277 kB/s)
Selecting previously deselected package libcurl3.
(Reading database ... 151563 files and directories currently installed.)
Unpacking libcurl3 (from .../libcurl3_7.21.6-3ubuntu3.2_i386.deb) ...
Selecting previously deselected package curl.
Unpacking curl (from .../curl_7.21.6-3ubuntu3.2_i386.deb) ...
Processing triggers for man-db ...
Setting up libcurl3 (7.21.6-3ubuntu3.2) ...
Setting up curl (7.21.6-3ubuntu3.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: Eveofwar on January 27, 2012, 02:54:28 AM
I typed in:


sudo apt-get install curl


and it gave me this: (is it installed?)

Quote
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libcurl3
The following NEW packages will be installed:
  curl libcurl3
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 369 kB of archives.
After this operation, 987 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main libcurl3 i386 7.21.6-3ubuntu3.2 [236 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main curl i386 7.21.6-3ubuntu3.2 [134 kB]
Fetched 369 kB in 1s (277 kB/s)
Selecting previously deselected package libcurl3.
(Reading database ... 151563 files and directories currently installed.)
Unpacking libcurl3 (from .../libcurl3_7.21.6-3ubuntu3.2_i386.deb) ...
Selecting previously deselected package curl.
Unpacking curl (from .../curl_7.21.6-3ubuntu3.2_i386.deb) ...
Processing triggers for man-db ...
Setting up libcurl3 (7.21.6-3ubuntu3.2) ...
Setting up curl (7.21.6-3ubuntu3.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

It is now.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 02:58:01 AM
I typed in:


sudo apt-get install curl


and it gave me this: (is it installed?)

Quote
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libcurl3
The following NEW packages will be installed:
  curl libcurl3
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 369 kB of archives.
After this operation, 987 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main libcurl3 i386 7.21.6-3ubuntu3.2 [236 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ oneiric-updates/main curl i386 7.21.6-3ubuntu3.2 [134 kB]
Fetched 369 kB in 1s (277 kB/s)
Selecting previously deselected package libcurl3.
(Reading database ... 151563 files and directories currently installed.)
Unpacking libcurl3 (from .../libcurl3_7.21.6-3ubuntu3.2_i386.deb) ...
Selecting previously deselected package curl.
Unpacking curl (from .../curl_7.21.6-3ubuntu3.2_i386.deb) ...
Processing triggers for man-db ...
Setting up libcurl3 (7.21.6-3ubuntu3.2) ...
Setting up curl (7.21.6-3ubuntu3.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

It is now.

o nice it worked just emailed me


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 03:02:18 AM
What is smsapi? where can I get that


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: Eveofwar on January 27, 2012, 03:06:26 AM
What is smsapi? where can I get that

You really are looking for another LMGTFY link huh ?


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 03:08:39 AM
What is smsapi? where can I get that

You really are looking for another LMGTFY link huh ?

what dat mean?

how can I make it so it checks multiple items?


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 04:47:48 AM
how do I make it loop and run the script again after say 5 minutes? Instead of just closing.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: BkkCoins on January 27, 2012, 06:11:39 AM
how do I make it loop and run the script again after say 5 minutes? Instead of just closing.
If you're asking about my script then it has a loop built in. No need to run every 5 minutes because the script runs non-stop and checks once per minute.


Title: Re: Auto-notify Script for Newegg 5830s (or any other site)
Post by: ragingazn628 on January 27, 2012, 06:23:44 AM
how do I make it loop and run the script again after say 5 minutes? Instead of just closing.
If you're asking about my script then it has a loop built in. No need to run every 5 minutes because the script runs non-stop and checks once per minute.

I haven't tried yours yet but the other one it stops after the first change. Yours doesn't do that? Also do you know any good US sites for free SMS API? I tried signing up for the other one but it wouldn't let me :(