The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
(w)get web server's directories + bash script reminiscent Shell Programming and Scripting 2 08-20-2008 12:21 PM
Able to ping server's private network *Jess* IP Networking 3 01-10-2008 08:45 PM
Solaris - unknown hostname - how can I change hostname? XNOR UNIX for Dummies Questions & Answers 1 03-29-2007 10:52 PM
How to use another server's CD FredSmith UNIX for Dummies Questions & Answers 2 11-14-2006 12:28 PM
Linux server's !_30 Gentoo 1 09-20-2006 03:12 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-29-2009
mbaste2 mbaste2 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 4
get the server's hostname

i read that if i issue :

cat /etc/sysconfig/network > textfile

i will be able to determine the hostname of the server that my linux workstation is connected to.

but there are several other lines outputted that i do not need. i just need the hostname part.

is there any other unix command i can use? i tried hostname, hostid but they give the name of the workstation, not the server's name.

thanks for any leads
  #2 (permalink)  
Old 06-29-2009
pludi's Avatar
pludi pludi is offline Forum Staff  
Moderator
  
 

Join Date: Dec 2008
Location: .at
Posts: 1,846
What exactly are, for you, the differences between "host name" and "server name"?

"hostname" will give you the machines host name. "hostname -f" will give you the machines FQDN (but this is Linux only). If you mean the DNS entry for an IP used by the machine, you could use "dig -x <IP>" to get that.
  #3 (permalink)  
Old 06-29-2009
mbaste2 mbaste2 is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 4
hostname, server's hostname

thanks pludi for quick reply.

i have to monitor several linux workstations connected to a linux server.

i intend to issue cron jobs in each of the workstations to get the processes running and output the results to a textfile daily.

so for every 30 minutes, cron job something like :
0,30 * * * * * ... ps c -FC "firefox-bin,soffice.bin, ..." >> textfile.txt

the textfile.txt is to contain the workstation's hostname as part of the filename which i can get by issuing hostname at the workstation prompt.

at the end of the day, the workstation has to copy that daily file to a subdirectory in the server. another cron job that i think will need the server's hostname this time. something like :

cp textfile.txt serverhostname/assigned/directory/
(or ssh, ftp, scp whichever will be applicable, please suggest.)

at end of the day, i should have 10 daily files coming from each of the 10 workstations at the serverhostname/assigned/directory/

as each of the textfile.txt contains the name of the workstation it came from, i can write a program to track which workstations are used more often and at what peak times for the processes being monitored from these log files.

this is for the high school administrators/lab manager who want to monitor what the computers in their internet lab are being used for and at what times.

i was worried that if the serverhostname is changed by the sysad at the server, my cron tasks and scripts will not run if i hardcode the serverhostname, thus my need to find it out from wherever (e.g. cat /etc/sysconfig/network > something.txt).

thanks, just a newbie here.
better leads how to accomplish above will be appreciated.

(i also have another problem -- how to make the ps command accept the "watched executables" from a csv file that can later be expanded instead of hardcoding each of the additional executables in the ps statement)
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:51 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0