10-23-2001
simple scripting question
I am new to scropting and I am just trying to work on a few simple things....
Using sh I want to do something similar to the follwoing run a simple command like a dig then I want it to get the server that it is authorotative and return it to me saying somehting like xx.xx is authorotative. I am not getting how to make it check the results and return a specific part to me how do I make it check the results it recieved and return a specific part of the results to me does this make sense? Is it possible. This is only an example of somethign I am trying to do I understand how to make it so that if a particualr event is true then do this but I dont understand how to make it check to see if that particualr even is present does this make sense let me know.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I am a beginner in unix shell scripting.
I wanted simple information like
1- How to know what are the number of command line options given for the script file?
2- How to check if a variable value is interger or string?
3- How to use awk to replace value of a variable
For example I... (5 Replies)
Discussion started by: Nads
5 Replies
2. UNIX for Dummies Questions & Answers
Ok what is BSD exactly? I know its a type of open source but what is it exactly? (1 Reply)
Discussion started by: Corrail
1 Replies
3. Shell Programming and Scripting
this is my script....
SQL> select * from dba_profiles
2 where resource_name in ('FAILED_LOGIN_ATTEMPTS','PASSWORD_LOCK_TIME')
3 order by profile;
and this is the output...
PROFILE RESOURCE_NAME RESOURCE... (2 Replies)
Discussion started by: liezer
2 Replies
4. UNIX for Dummies Questions & Answers
I tried to do a search, but it couldnt pinpoint what my answer since using limited but broad keywords. Sorry in advance ; ;
Im limited to using Bourne shell scripting only, atm I have the following code (just the heading part of it)
...
...
# VARIABLE DECLARATION
# ====================
... (2 Replies)
Discussion started by: eeto
2 Replies
5. Shell Programming and Scripting
Hi there,
I was trying to add a line of text in the middle line of a file.
I have counted the lines in the file, and then I divide it into 2, after that I am stuck on how am I suppose to append the line on that file? When I tried to use this command 'second line >> filename' it appends it at... (3 Replies)
Discussion started by: felixwhoals
3 Replies
6. Shell Programming and Scripting
Hi,
The logic is very simple but I can't seem to make this work in Korn shell.
I need to check two files to make sure there is no errors. Each of the file will have number. For example, first file btt.txt will have 112 which is good. Second file bgg.txt will have 6 which is also good. If I... (4 Replies)
Discussion started by: samnyc
4 Replies
7. Shell Programming and Scripting
Hi there. I'm trying to teach myself UNIX but the book I bought is a bit confusing. I'm trying out this exercise and I think I'm on the right track, but I'd appreciate any suggestions on how to improve what I have so far. Also, I'm not clear on how to use the read command to utilize the user's... (3 Replies)
Discussion started by: Jsmith
3 Replies
8. Shell Programming and Scripting
echo "what is your username?"
read username
echo $username
echo /home/$username
$backup="backup"
$restore="restore"
#
#
if
then
echo "No username provided"
else
echo "hi $username would you like to backup or restore?"
read userrequest
echo $userrequest
if
then
... (4 Replies)
Discussion started by: EwanD
4 Replies
9. Shell Programming and Scripting
Hello,
I want to find the "IP-OF-SERVER" in /etc/squid/squid.conf And replace it with The IP of server.
I know this command returns the IP of server :
ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'
And I can replace with sed. :
sed -i... (4 Replies)
Discussion started by: Ghadamyari
4 Replies
10. Red Hat
Cheers!
In /etc/syslog.conf, if an error type is not specified, is it logged anywhere (most preferable is it logged to /var/log/messages) or not?
To be more precise I am interested in error and critical level messages. At default these errors are not specified in syslog.conf, and I need to... (6 Replies)
Discussion started by: dr1zzt3r
6 Replies
slack(8) System Manager's Manual slack(8)
NAME
slack - Sysadmin's lazy autoconfiguration kit
SYNOPSIS
slack [option ...] [role ...]
DESCRIPTION
slack is a master command which coordinates the activities of its backends, which variously:
o determine the list of roles to be installed on this server
o create a local cached copy of the role files from the central repository
o merge file trees from subroles into a single, unified tree
o install files onto the local filesystem
o run scripts before and after installation
Options you give to slack will be generally passed along to the backends where relevant.
OPTIONS
-h, --help
Print a usage statement.
--version
Print the version and exit.
-v, --verbose
Increase verbosity. Can be specified multiple times.
--quiet
Don't be verbose (Overrides previous uses of --verbose).
-C, --config FILE
Use the specfied FILE for configuration instead of the default, /etc/slack.conf.
-s, --source DIR
Source directory for slack files
-e, --rsh COMMAND
Remote shell for rsync
-c, --cache DIR
Local cache directory for slack files
-t, --stage DIR
Local staging directory for slack files
-r, --root DIR
Root destination for slack files
--no-sync
Skip the slack-sync step (useful if you're pushing stuff into the CACHE outside slack).
--no-files
Don't install any files in ROOT, but tell rsync to print what it would do.
--no-scripts
Don't run scripts
-n, --dry-run
Same as --no-files --no-scripts (CACHE, STAGE will still be updated)
--role-list
Role list for slack-getroles(8).
-b, --backup
Make backups of existing files in ROOT that are overwritten. This option defaults to on if it is not set to 0 in a config file or
disabled with --nobackup on the command line.
--backup-dir
Put backups from the --backup option into this directory.
-H, --hostname HOST
Pretend to be running on HOST, instead of the name given by gethostname(2).
--preview MODE
Do a diff of scripts and files before running them. MODE can be one of 'simple' or 'prompt' (See PREVIEW MODES, below).
--diff PROG
Use this diff program for previews.
--sleep TIME
Randomly sleep between 1 and TIME seconds before starting operations. Useful in crontabs.
PREVIEW MODES
Preview functionality is new in slack 0.14.0. I haven't quite worked out how things will work, so this usage is somewhat subject to change
in future versions. I thought I would try it this way and see how people like it.
In 'simple' mode, after syncing and staging the files directory, slack will present a diff of the files and scripts. In this mode, slack
will not run the preinstall or fixfiles scripts, and because of this, it may provide some false output about permissions changes to files.
In 'prompt' mode, after syncing and staging the files directory, slack will diff the script directory. If there are differences, slack
will present them to you and ask you if you want to continue. If you say no, it will exit. If you say yes, it will stage the scripts
directory, run the preinstall and fixfiles scripts, and then diff the files in the stage with those in the root. If there are differences,
slack will present them to you and ask you if you want to continue. If you say no, it will exit. If you say yes, it will install the
files and run the postinstall script.
So, the 'simple' mode is easy to use, and will be accurate if you don't use fixfiles. The 'prompt' mode will be accurate if you use fix-
files, but requires some interaction.
Why can't we just have one mode that works with fixfiles and requires no interaction? Well, that would require slack to understand what
your free-form fixfiles executable was going to do, which would either require some kind of universe simulator or would require you to
write your fixfiles in a less free-form way, which would make slack less like slack.
EXAMPLES
To install all the roles configured in the role list for a server:
slack
To install a specific role:
slack rolename
To test a new role before checking in the changes:
slack --source user@workstation:/home/user/.../slack rolename
To avoid killing your master server when calling from cron:
slack --sleep 3600
FILES
/etc/slack.conf
SEE ALSO
slack.conf(5), rsync(1)
Administrative commands 2004-10-22 slack(8)