Sponsored Content
Full Discussion: Need help creating a script
Top Forums Shell Programming and Scripting Need help creating a script Post 66304 by Just Ice on Saturday 12th of March 2005 10:13:26 AM
Old 03-12-2005
jim's code as written is correct ...

but instead of just snmpget why don't you do a ping with a timeout first so you don't have to wait forever for each ip address ... i've modified jim's code below using a 5 second timeout on ping and taking out the "Timeout:" error ...

Code:
#!/bin/ksh
# assuming snmpget returns non-zero when printer not running snmp
echo "These ip addresses are not running snmp on " `date` > nosnmp.log
while read ipaddr
do
    ping $ipaddr 5 > /dev/null 2>&1
    if [ $? -eq 0 ]
    then   
          snmpget -v 1 -c public $ipaddr sysName.0 2> /dev/null
          if [ $? -ne 0 ]; 
          then 
                echo "$ipaddr" >> nosnmp.log
          fi
     else
          echo "$ipaddr" >> nosnmp.log
     fi 
done < iplist.txt

or else you can simply do ... since an unpingable networked printer is technically off the network functionwise ... (assuming a 2 second ping timeout) ...

Code:
#! /bin/ksh
echo "These ip addresses are unpingable as of [ `date` ]\n" > noping.log
for ipaddr in `< iplist.txt`
do
     ping $ipaddr 2 2> /dev/null
     if [ $? -ne 0 ]
     then
           echo "$ipaddr" >> noping.log
     fi
done

exit 0

 

10 More Discussions You Might Find Interesting

1. Programming

creating a new C script

All right. Heres the deal, I need to know everysingle command or funtion there is to create a new c file (file.c). Heres the catch: I cannot use text editors!!!:mad: I heard of a "gcc" command is that any good?:confused: Thanks..:cool: (2 Replies)
Discussion started by: AbRa-KaDabRa
2 Replies

2. UNIX for Dummies Questions & Answers

creating a script

I am trying to create a application in OSX through UNIX that will run a script to mount an image from a CD-ROM and run the application which it corresponds to, all with double clicking on a icon in OSX. Any thoughts or ideas? -Mad (3 Replies)
Discussion started by: madknowledge
3 Replies

3. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

Hi, I need help urgently for following issue. Pls help me to resolve this issue. I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql) I given... (6 Replies)
Discussion started by: praka
6 Replies

4. Shell Programming and Scripting

help needed with creating challenging bash script with creating directories

Hi, Can someone help me with creating a bash shell script. I need to create a script that gets a positive number n as an argument. The script must create n directories in the current directory with names like map_1, map_2 etcetera. Each directory must be contained within its predecessor. So... (7 Replies)
Discussion started by: I-1
7 Replies

5. Programming

need help with creating a sh script

Hi everyone I’m not a programmer and my knowledge of scripting is very poor, now I’m stock in a task at work and would really appreciate it if someone could help me out. Here is the problem: 1. I have a file with 9 million entries that look like this : 611424167 610864581 611881523 609585386... (3 Replies)
Discussion started by: hiker1064
3 Replies

6. UNIX for Dummies Questions & Answers

Creating a script

Alright, well I did some more research since I originally posted this thread, and as much as I'd like to delete it, I can't, so I'll just extend my initial question a little. Right now I have 3 scripts: 1#!/bin/bash # script1 - Write all files modfied x days ago find .. -daystart -mtime 0... (2 Replies)
Discussion started by: Aussiemick
2 Replies

7. Shell Programming and Scripting

Need help in creating file restoration script from a backup script.

Hi all i am struggling in creating a restore of env files while doing applications clone. the first file i created for copying the important configurations file which is running perfect now for reverting the changes i mean when i am restoring these files to its original places i have to do... (7 Replies)
Discussion started by: javeedkaleem
7 Replies

8. Shell Programming and Scripting

Creating IN list in PLSQL script dynamically by using shell script

Hi all, I have a PLSQL script which has a IN list where it takes some ids as input. For example SELECT * FROM EMPLOYEE WHERE EMPLOYEE_ID IN (comma separated list ) I want to run this quest inside a shell script but I would like to prepare the IN list dynamically where the employee ids... (1 Reply)
Discussion started by: LoneRanger
1 Replies

9. Shell Programming and Scripting

Help with creating a script

Hi everyone, I am completely new to this forum and I have some questions regarding a script I am writing. I would be happy if anyone could help me with the small and precise script which should include if, then, else, while until, case and select. The scenario is as follows: 1) A user... (3 Replies)
Discussion started by: codenotfound
3 Replies

10. UNIX for Advanced & Expert Users

Creating script in rc.d

Hi, I have created customized scripts to start httpd and postgres (For CentOS 6) in /etc/init.d. However for it to work even after reboot, I have to put the script in /etc/rc.d/rc0.d, rc1.d, etc. # ls -lrt total 60 -rwxr-xr-x 1 root root 20199 Oct 4 2017 rc.sysinit -rwxr-xr-x 1... (6 Replies)
Discussion started by: anaigini45
6 Replies
RADMIN(8)					       FreeRADIUS Server Administration Tool						 RADMIN(8)

NAME
radmin - FreeRADIUS Administration tool SYNOPSIS
radmin [-d config_directory] [-e command] [-E] [-f socket_file] [-h] [-i input_file] [-n name] [-o output_file] [-q] DESCRIPTION
FreeRADIUS Server administration tool that connects to the control socket of a running server, and gives a command-line interface to it. At this time, only a few commands are supported. Please type "help" at the command prompt for detailed information about the supported commands. WARNING
The security protections offered by this command are limited to the permissions on the Unix domain socket, and the server configuration. If someone can connect to the Unix domain socket, they have a substantial amount of control over the server. OPTIONS
The following command-line options are accepted by the program. -d config directory Defaults to /etc/raddb. radmin looks here for the server configuration files to find the "listen" section that defines the control socket filename. -e command Run command and exit. -E Echo commands as they are being executed. -f socket_file Specify the socket filename directly. The radiusd.conf file is not read. -h Print usage help information. -i input_file Reads input from the specified file. If not specified, stdin is used. This also sets "-q". -n mname Read raddb/name.conf instead of raddb/radiusd.conf. -o output_file Write output to the specified file. If not specified, stdout is used. This also sets "-q". -q Quiet mode. COMMANDS
The commands implemented by the command-line interface are almost completely controlled by the server. There are a few commands inter- preted locally by radmin: reconnect Reconnect to the server. quit Exit from radmin. exit Exit from radmin. The other commands are implemented by the server. Type "help" at the prompt for more information. EXAMPLES
debug file /var/log/radius/bob.log Set debug logs to /var/log/radius/bob.log. There is very little checking of this filename. Rogue administrators may be able use this command to over-write almost any file on the system. If those administrators have write access to "radius.conf", they can do the same thing without radmin, too. debug condition '(User-Name == "bob")' Enable debugging output for all requests that match the condition. Any "unlang" condition is valid here. The condition is parsed as a string, so it must be enclosed in single or double quotes. Strings enclosed in double-quotes must have back-slashes and the quotation marks escaped inside of the string. Only one debug condition can be active at a time. debug condition '((User-Name == "bob") || (Packet-Src-IP-Address == 192.0.2.22))' A more complex condition that enables debugging output for requests containing User-Name "bob", or requests that originate from source IP address 192.0.2.22. debug condition Disable debug conditionals. FULL LIST OF COMMANDS
add <command> do sub-command of add add client <command> Add client configuration commands add client file <filename> Add new client definition from <filename> debug <command> debugging commands debug condition [condition] Enable debugging for requests matching [condition] debug level <number> Set debug level to <number>. Higher is more debugging. debug file [filename] Send all debugging output to [filename] del <command> do sub-command of del del client <command> Delete client configuration commands del client ipaddr <ipaddr> Delete a dynamically created client hup [module] sends a HUP signal to the server, or optionally to one module inject <command> commands to inject packets into a running server inject to <ipaddr> <port> Inject packets to the destination IP and port. inject from <ipaddr> Inject packets as if they came from <ipaddr> inject file <input-file> <output-file> Inject packet from input-file>, with results sent to <output-file> reconnect reconnect to a running server terminate terminates the server, and cause it to exit set <command> do sub-command of set set module <command> set module commands set module config <module> variable value set configuration for <module> set module status [alive|dead] set the module to be alive or dead (always return "fail") set home_server <command> set home server commands set home_server state <ipaddr> <port> [alive|dead] set state for given home server show <command> do sub-command of show show client <command> do sub-command of client show client config <ipaddr> show configuration for given client show client list shows list of global clients show debug <command> show debug properties show debug condition Shows current debugging condition. show debug level Shows current debugging level. show debug file Shows current debugging file. show home_server <command> do sub-command of home_server show home_server config <ipaddr> <port> show configuration for given home server show home_server list shows list of home servers show home_server state <ipaddr> <port> shows state of given home server show module <command> do sub-command of module show module config <module> show configuration for given module show module flags <module> show other module properties show module list shows list of loaded modules show module methods <module> show sections where <module> may be used show uptime shows time at which server started show version Prints version of the running server show xml <reference> Prints out configuration as XML stats <command> do sub-command of stats stats client [auth/acct] <ipaddr> show statistics for given client, or for all clients (auth or acct) stats home_server [<ipaddr>/auth/acct] <port> show statistics for given home server (ipaddr and port), or for all home servers (auth or acct) stats detail <filename> show statistics for the given detail file SEE ALSO
unlang(5), radiusd.conf(5), raddb/sites-available/control-socket AUTHOR
Alan DeKok <aland@freeradius.org> 14 Mar 2011 RADMIN(8)
All times are GMT -4. The time now is 10:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy