On Sat, Sep 06, 2008 at 02:27:27AM -0600, kwhiskerz wrote:
> This is OT, but perhaps someone knows an answer.
> 
> Is there a way a script can determine which computer it is running on and 
> refuse to run if it is on the wrong computer?
> 
> if [ some case ]; then

if [ "$(hostname -s)" = "puter" ]; then
  echo running
fi

Or, for multiple cases:

case "$(hostname -s)" in
  ws*)
    do_something
    ;;
  db*|app*)
    do_other
    ;;
esac

-- 
lfr
0/0

Attachment: pgp2CXYlUmOh1.pgp
Description: PGP signature

-- 
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

Reply via email to