2 questions about the WGET command

I’m using the “wget” command to get the date from Yahoo.com. So this is what I use on Solaris:

/usr/sfw/bin/wget --timeout=3 -S Yahoo!

This works well when my computer is linked to the Net. But when it’s not, this command just hangs. I thought putting the timemout = 3 will make this command stop in 3 seconds, but it doesn’t. Does anyone know what the exact command is to make this command stop after a few seconds if it can’t make a connection to the Net?

Also, when this command runs successfully, it creates a file called “index.html” What do I need to do so that it doesn’t automatically create the file “index.html” in my local directory? Thanks.

–tries=1 --timeout=3 works fine for me.

If you don’t want the content you can redirect it to /dev/null:

wget -O /dev/null blahblah

I’m using the “wget” command to get the date from Yahoo.com

Why are you using this to get date?

Someone suggested it.

Is there a simpler way to get the date from Yahoo?

Why not use “date”?

I cannot use “date” from the local UNIX station because if that date is changed, my script will have the wrong value.

I need to get the date value from a site like Google.com, to ensure the date is correct.

Why not use NTP?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Agreed… why do you think your computer’s time will be out of sync?
Unless you have a serious drift problem (unlikely) or you poweroff and
have a bad CMOS battery (doesn’t happen often) and also don’t use NTP on
startup your time should be accurate and the ‘date’ command will be a ton
faster. Also chances are extremely high that your connection will be down
more-often than your system date will (or should be) wrong. Yast: Network
Services: NTP Configuration. Point to ‘pool.ntp.org’ if nothing else.

Good luck.

ken yap wrote:
> Why not use NTP?
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJJ6+/mAAoJEF+XTK08PnB5YjYQAJtHyM3aZf2ujizmIPX5QrFe
uplW4Nq5c6DiFuTL4Km2IKtzZ1e6ALi+SVzESW9HNo8PhPp45LkFNPRxZ5ur7NIo
tNz1eRbFV1FGYm520Z5PHF8YYMSsPo6ITELslbShc6d05G4Tf60Oa21zYYP1IjYA
jEdpE1uB0M+DcD5jYRSfvz+DsvI81HlNoETm3eRCzCtl9LtHCFOT97qnvcTNPZ/e
PEKt/Q7ONGsOg+5WcuoyCNWsFTWVCdEuZbOsUnWpxhiLqv6DNIRi6nSIUw62HtDP
hjZ7kEZ51Up6ZWfY2cjHtugOmqzgvbY4VXVvTOFqOal3sxss6xoGP8koohVReUj5
3Rv/4RgejJlsWJwKew3vIESqiFDg8h1BPs5CMFeT2wW9vTMFG5UR8Zo+n3ysru6B
7fzQbHJtKeGunWLRqmpflfcM0bNkSdznvND9/T7sDpCPHkFs092VZMWmWdBQOZye
Tn9awuZ5f44s3E/0gaJbXGjOZ1Zy4bpVKxcHbgPZp5q8pSXeU7qNV0iymRc/yGtA
UmrCiWfvseiZprJ/m5k+RZoNn3mxgz1j5ejNyPCF0SdlRVtzGUZcTmjREwsNY8Is
Oyfcqmea+JHKjWCRP8SghY8C0mOxI7gYPeZogxkgVplGZD6AHrwYrpDqQAzVT1Qq
VS5w6yE43cfjGfIcOmre
=m4DE
-----END PGP SIGNATURE-----