Hi,
is there any reliable way to determine if a script is run in the toolserver cluster, i. e. can make use of the database servers & Co., without checking for hostname being wolfs- bane, nightshade or names-to-come?
TIA, Tim
Tim Landscheidt wrote:
Hi,
is there any reliable way to determine if a script is run in the toolserver cluster, i. e. can make use of the database servers & Co., without checking for hostname being wolfs- bane, nightshade or names-to-come?
TIA, Tim
Check if it can connect to the database server?
Platonides platonides@gmail.com wrote:
is there any reliable way to determine if a script is run in the toolserver cluster, i. e. can make use of the database servers & Co., without checking for hostname being wolfs- bane, nightshade or names-to-come?
Check if it can connect to the database server?
No, as:
a) the database servers may be down, and b) running the script on another box somewhere on the net would require waiting for the timeout/rejection of the connection *on* *every* *run* :-).
Tim
On Wed, 2009-09-02 at 15:55 +0000, Tim Landscheidt wrote:
Platonides platonides@gmail.com wrote:
is there any reliable way to determine if a script is run in the toolserver cluster, i. e. can make use of the database servers & Co., without checking for hostname being wolfs- bane, nightshade or names-to-come?
Given that you need to give it server-specific database login details anyway, you can presumably just check to see if those are available.
Conrad
Tim
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette
Hi Tim,
Tim Landscheidt schreef:
is there any reliable way to determine if a script is run in the toolserver cluster, i. e. can make use of the database servers & Co., without checking for hostname being wolfs- bane, nightshade or names-to-come?
Hostnames will change over time. Domainname (toolserver.org) should stay the same.
Maarten
I use this in my shell scripties:
if [ "`hostname --domain 2>/dev/null`" = "toolserver.org" ]; then echo on cluster else echo off cluster fi
-Darren
-- Darren Hardy Ph.D. Candidate Bren School of Environmental Science & Management University of California, Santa Barbara http://www.bren.ucsb.edu/~dhardy dhardy@bren.ucsb.edu
On 2 Sep 2009, at 5:39 AM, Tim Landscheidt wrote:
Hi,
is there any reliable way to determine if a script is run in the toolserver cluster, i. e. can make use of the database servers & Co., without checking for hostname being wolfs- bane, nightshade or names-to-come?
TIA, Tim
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Darren R. Hardy:
I use this in my shell scripties:
if [ "`hostname --domain 2>/dev/null`" = "toolserver.org" ]; then
this won't work on the web server as there is no --domain option.
- river.
Could parse hostname --fqdn Fahad Sadah
2009/9/2 River Tarnell river@loreley.flyingparchment.org.uk
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Darren R. Hardy:
I use this in my shell scripties:
if [ "`hostname --domain 2>/dev/null`" = "toolserver.org" ]; then
this won't work on the web server as there is no --domain option.
- river.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (HP-UX)
iEYEARECAAYFAkqer28ACgkQIXd7fCuc5vI/owCfXkrJuqNSguMmlPxNrj5RyHu8 EaEAoLOYFyO5SDGSoDrw9kIcViZHYV62 =pjAs -----END PGP SIGNATURE-----
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org) https://lists.wikimedia.org/mailman/listinfo/toolserver-l Posting guidelines for this list: https://wiki.toolserver.org/view/Mailing_list_etiquette
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Fahad Sadah:
2009/9/2 River Tarnell river@loreley.flyingparchment.org.uk
this won't work on the web server as there is no --domain option.
Could parse hostname --fqdn
there is no --fqdn option either. hostname on Solaris does not accept any options.
- river.
On Wed, Sep 2, 2009 at 2:23 PM, River Tarnellriver@loreley.flyingparchment.org.uk wrote:
there is no --fqdn option either. hostname on Solaris does not accept any options.
I ended up using this in my .bash_aliases:
if ([ `uname` = 'Linux' ] && (hostname --fqdn | grep toolserver &>/dev/null)) \ || ([ `uname` = 'SunOS' ] && (check-hostname | grep toolserver &>/dev/null))
Clearly, users of non-bash shells should use >/dev/null 2>&1 instead of &>/dev/null. It's probably cleaner to do `which check-hostname
/dev/null` instead of the explicit OS check. So you could do
if ! `which check-hostname >/dev/null`; then alias check-hostname='hostname --fqdn' fi
Then use check-hostname as you like. Of course, from the man page, it looks like check-hostname is part of sendmail, so I don't know how reliably available it is, but it's worked for me so far. :P
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Il giorno 02/set/09, alle ore 14:39, Tim Landscheidt ha scritto:
Hi,
is there any reliable way to determine if a script is run in the toolserver cluster, i. e. can make use of the database servers & Co., without checking for hostname being wolfs- bane, nightshade or names-to-come?
In PHP:
$DEBUG=(preg_match("/\btoolserver.org$/", $_SERVER['SERVER_NAME']) ? false : true); if($DEBUG) // Not on TS. else // ON TS
"I'm Outlaw Pete, I'm Outlaw Pete, Can you hear me?" Pietrodn powerpdn@gmail.com
toolserver-l@lists.wikimedia.org