Sponsored Content
Full Discussion: get the server's hostname
Top Forums UNIX for Dummies Questions & Answers get the server's hostname Post 302329958 by mbaste2 on Monday 29th of June 2009 10:00:13 PM
Old 06-29-2009
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)
 

10 More Discussions You Might Find Interesting

1. IP Networking

looking up hostname

Using Solaris 8 (or WINXP). I am trying to look up a specific DNS hostname, but I don't know which DNS server houses that entry. How can I find the hostname? nslookup gives me the following: C:\>nslookup hostname Server: dnsserver Address: x.x.x.x *** dnsserver can't find hostname:... (2 Replies)
Discussion started by: dangral
2 Replies

2. UNIX for Dummies Questions & Answers

Solaris - unknown hostname - how can I change hostname?

Hello, I am new to Solaris. I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Discussion started by: XNOR
1 Replies

3. UNIX for Advanced & Expert Users

how do change hostname of a unix server

what command do you use to change a unix server name. i've tried hostname, but when the unix server is rebooted, it reverts back to the old server name. regards venhart (3 Replies)
Discussion started by: venhart
3 Replies

4. Solaris

Assigning two hostname to single server

Hi All, Is there any option where in I can assign the two hostname to single system. Thanks (6 Replies)
Discussion started by: kumarmani
6 Replies

5. Red Hat

SEt two hostname in a linux server

Friends , Can I set two hostname in a Linux server at a time ? I want to give two hostname of my Linux server , is it possible to do ? Plz inform .. .. (2 Replies)
Discussion started by: shipon_97
2 Replies

6. Emergency UNIX and Linux Support

HP UX - ILO Console hostname different than Machine Hostname...

Hi All, So we added a new HP-UX 11.31 machine. Copied OS via Ignite-UX (DVD)over from this machine called machine_a. It was supposed to be named machine_c. And it is when you log in...however when I'm in the ILO console before logging in, it says: It should say: What gives? And how do... (4 Replies)
Discussion started by: zixzix01
4 Replies

7. Solaris

my sun solaris 10 cannot ping and nslookup other server using hostname.

hi.... i have sun solaris 10 server, fedora 10, and Windows Server.. i cant ping my sun solaris 10, fedora 10 and Windows Server using hostname (etc: ping winserver.bengkel2.com), but i can ping all using IPV4 and IPV6 address.. can u give some suggestion to solve my problem or some idea to... (3 Replies)
Discussion started by: izuan_7657
3 Replies

8. Solaris

2 hostname in one server

Hi, We have one server originally named <SERVERA>. Now we plan to put another network card & add another hostname <SERVERB>. Later, we will need to change hostname from <SERVERB> to <SERVERC>. I know that we need to plumb a new ip & add to /etc/hosts & /etc/hostname.<interface>. Is there... (2 Replies)
Discussion started by: beginningDBA
2 Replies

9. Red Hat

After umount -lf: kernel: nfs: server HOSTNAME not responding, timed out

Greetings! I'm testing a failover solution for NFSv4 on RHEL6 with latest updates. My script umounts (umount -lf /share) the faulty NFS share if it sees that's hanging on the client (the NFS daemon is down on the NFS server) and it mounts the share from another healthy NFS server. Sometimes... (4 Replies)
Discussion started by: Arsene Lupen
4 Replies

10. UNIX for Advanced & Expert Users

Hostname -f hostname: Unknown host

deleted (0 Replies)
Discussion started by: hce
0 Replies
ypwhich(1)						      General Commands Manual							ypwhich(1)

NAME
ypwhich - return name of NIS server or map master SYNOPSIS
ypwhich [ -d domain ] [ -Vn ] [ hostname ] ypwhich [ -d domain ] [ -t ] -m [ mname ] ypwhich -x DESCRIPTION
ypwhich returns the name of the NIS server that supplies the NIS services to a NIS client, or which is the master for a map. If invoked without arguments, it gives the NIS server for the local machine. If hostname is specified, that machine is queried to find out which NIS master it is using. OPTIONS
-d domain Specify a domain other than the default domain. -t This option inhibits map nickname translation. -m mname Find the master NIS server for a map. No hostname can be specified with the -m option. mname can be a mapname or nickname for a map. If mname is omitted, ypwhich will produce a list of available maps. -x Display the map nickname translation table. -Vn Version of ypbind(8), V2 is default. FILES
/var/yp/nicknames map nickname translation table. SEE ALSO
domainname(8), nicknames(5), ypbind(8), ypcat(1), ypmatch(1), yppoll(8), ypserv(8), ypset(8) AUTHOR
ypwhich is part of the yp-tools package, which was written by Thorsten Kukuk <kukuk@linux-nis.org>. YP Tools 2.14 April 2010 ypwhich(1)
All times are GMT -4. The time now is 09:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy