11-02-2008
Ok I understand the cd $1 concept on getting the directory from the user but I thought there was a way to make the script not even execute unless the user typed in an argument or parameter right after typing the scriptname. So if the user just runs the scipt without giving a directory I dont want it to run. Make sense? Sorry again I'm new at this. Thank you for your time though.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
First off I usually script in the bash shell.
Ok, in my script I am checking to see if the filename has a .txt extension.
So I was trying:
if
then
echo "Must contain a valid .txt extension"
fiandif ]
then
echo "Must contain a valid .txt extension"
fiBut no go the first... (5 Replies)
Discussion started by: Astudent
5 Replies
2. UNIX for Dummies Questions & Answers
Correct me if i'm wrong, but by adding "#!/bin/ksh" at the start of a script will force it to run in the korn shell no matter which shell you are currently using?? (2 Replies)
Discussion started by: shad0w75
2 Replies
3. Shell Programming and Scripting
I'm using solaris and i have an old script that an ex employee wrote but i can't seem to get it working. well is just one part of the script
if ($?MC_PROD_DIR == 0) setenv MC_PROD_DIR $HOME/PRODUCTION
source $MC_PROD_DIR/scripts/localenv
** i understand what this part of the script is... (1 Reply)
Discussion started by: fusionjd
1 Replies
4. UNIX for Dummies Questions & Answers
Can anyone help with these scripts? Im new to this and struggling. Thank you for your help.
Pre-requisites
Create a file with x amount of lines in it, the content of your choice. (Have already done this)
Script 1
Write a script that takes two arguments. The first being a line of text,... (3 Replies)
Discussion started by: beginner1
3 Replies
5. Shell Programming and Scripting
Anyone know why this won't work?
#!/usr/bin/ksh
for db in `cat /etc/oratab|egrep ':N|:Y' | grep -v \* | cut -f1 -d":"`
do
echo "************************"
echo "database is $db"
echo "************************"
done
I am getting an error on the line... (7 Replies)
Discussion started by: ace2000
7 Replies
6. Shell Programming and Scripting
Here is my problem.
I have a txt file with a list of user names in both upper case and lower case. I need to remove the names from the passwd file. I want to be able to run a script that looks at my txt list and then removes those names from the passwd file. It would be nice if it backed up the... (3 Replies)
Discussion started by: wgartin
3 Replies
7. Shell Programming and Scripting
I am trying to write a script to check the STIG our unix boxes. I want to put in checks to determine if certain files or directories are there. For example:
If /opt/SUNWexplo exists
echo "Sun Explorer exists"
else
echo "Sun Explorer is not installed"
I am sure I could write... (2 Replies)
Discussion started by: rkruck
2 Replies
8. Shell Programming and Scripting
How can I include a counter in this if statement so only sends out 5 notifications.
# the if statement will check for the lines status, if status is down sends email
if
then
LIST="user@email.com"
mail -s "rje_lines_down" $LIST < ${tmpfile} #sends an email to list
fi
thanks... (2 Replies)
Discussion started by: d4n3lu
2 Replies
9. Shell Programming and Scripting
I know some tricks like this : echo " E"; sleep 0.1; clear;
echo " Er"; sleep 0.1; clear;
echo " Err"; sleep 0.1; clear;
echo " Erro"; sleep 0.1; clear;
echo " Error ";... (2 Replies)
Discussion started by: hakermania
2 Replies
10. Programming
Gents for 2013 I have embarked on learning C and just wrote my first script and need some help. In the learning process, I am trying to understand where I went wrong with my script. The flow of the script is as such:
Enter a number --> check if it is a number --> if it is not a number,print what... (4 Replies)
Discussion started by: metallica1973
4 Replies
LEARN ABOUT DEBIAN
upssched.conf
UPSSCHED.CONF(5) NUT Manual UPSSCHED.CONF(5)
NAME
upssched.conf - Configuration for upssched timer program
DESCRIPTION
This file controls the operations of upssched(8), the timer-based helper program for upsmon(8).
CONFIGURATION DIRECTIVES
CMDSCRIPT scriptname
Required. This must be above any AT lines. This script is used to invoke commands when your timers are triggered. It receives a single
argument which is the name of the timer that caused it to trigger.
PIPEFN filename
Required. This sets the file name of the socket which will be used for interprocess communications. This should be in a directory where
normal users can't create the file, due to the possibility of symlinking and other evil.
Caution
if you are running Solaris or similar, the permissions that upssched sets on this file are not enough to keep you safe. If your OS
ignores the permissions on a FIFO, then you MUST put this in a protected directory!
Note
by default, upsmon(8) will run upssched as whatever user you have defined with RUN_AS_USER in upsmon.conf(8). Make sure that user can
create files and write to files in the path you use for PIPEFN and LOCKFN.
My recommendation: create a special directory for upssched, make it owned by your upsmon user, then use it for both.
The stock version of the upssched.conf ships with PIPEFN disabled to make you visit this portion of the documentation and think about how
your system works before potentially opening a security hole.
LOCKFN filename
Required. upssched attempts to create this file in order to avoid a race condition when two events are dispatched from upsmon at nearly
the same time. This file will only exist briefly. It must not be created by any other process.
You should put this in the same directory as PIPEFN.
AT notifytype upsname command
Define a handler for a specific event notifytype on UPS upsname. upsname can be the special value * to apply this handler to every
UPS.
This will perform the command command when the notifytype and upsname match the current activity. Possible values for command are:
START-TIMER timername interval
Start a timer of interval seconds. When it triggers, it will pass the argument timername as an argument to your CMDSCRIPT.
Example:
Start a timer that'll execute when any UPS (*) has been gone for 10 seconds
AT COMMBAD * START-TIMER upsgone 10
CANCEL-TIMER timername [cmd]
Cancel a running timer called timername, if possible. If the timer has passed then pass the optional argument cmd to CMDSCRIPT.
Example:
If a specific UPS (myups@localhost) comes back online, then stop the timer before it triggers
AT COMMOK myups@localhost CANCEL-TIMER upsgone
EXECUTE command
Immediately pass command as an argument to CMDSCRIPT.
Example:
If any UPS (*) reverts to utility power, then execute ups-back-on-line via CMDSCRIPT.
AT ONLINE * EXECUTE ups-back-on-line
Note that any AT that matches both the notifytype and the upsname for the current event will be used.
For a complete list of notifytype possible values, refer to the section NOTIFY EVENTS in upsmon(8).
SEE ALSO
upssched(8), upsmon(8)
Internet resources:
The NUT (Network UPS Tools) home page: http://www.networkupstools.org/
Network UPS Tools 05/21/2012 UPSSCHED.CONF(5)