03-20-2008
Can you edit/re-submit with code tags?
Being able to see the script indented makes if - then - else and other stuctures easier to read and follow.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am running an Ubuntu Gutsy laptop with Advanced Compiz fusion options enabled. I am using xdotool to simulate keyboard input in order to rotate through multiple desktops.
I am looking for a way to kill a while true loop when the Enter key (or Control+C if it is easier) is pushed when the... (2 Replies)
Discussion started by: acclaypool
2 Replies
2. Shell Programming and Scripting
I wonder if someone could help me here. I am trying to find a way of exiting from a loop but not exiting me from the script for example
#!/bin/ksh
# ************* FUNCTIONS ******************
function1() { #ping test
ping $1 2 > /dev/null
if ; then
... (13 Replies)
Discussion started by: hcclnoodles
13 Replies
3. UNIX Benchmarks
Hardware Overview:
Model Name: Power Mac G5
Model Identifier: PowerMac7,2
Processor Name: PowerPC 970 (2.2)
Processor Speed: 1.8 GHz
Number Of CPUs: 2
L2 Cache (per CPU): 512 KB
Memory: 1.5 GB
Bus Speed: 900 MHz
Boot ROM Version:... (0 Replies)
Discussion started by: tnorth
0 Replies
4. UNIX for Advanced & Expert Users
Greeting,
The following script completes after reading only one record from the input file that contains many records. I commented out the "ssh" and get what I expect, an echo of all the records in the input.txt file. Is ssh killing the file handle?
On the box "uname -a" gives "SunOS... (2 Replies)
Discussion started by: twk
2 Replies
5. Shell Programming and Scripting
Hi my code looks like:
if test $STEP -le 10
then
.
.
ls -1d AM*-OUT|while read MYDIR
do
cd $MYDIR
ls |tail -n1| while read MYFILE
do
.
.
if test -s $MYFILE
then
sqlldr ....
rc=$?
if test $rc -ne 0 (3 Replies)
Discussion started by: anijan
3 Replies
6. Shell Programming and Scripting
Hi,
I have a really simple script which I want to run forever, inside the loop it runs a C application which if it exits should restart.
#!/bin/sh
while true
do
./SCF scf.conf >> scf.log
sleep 2
done
For some reason the SCF C application coredumps and the script is exiting.... (3 Replies)
Discussion started by: marvinwright
3 Replies
7. Shell Programming and Scripting
Hi I am having a problem exiting a WHILE loop. I am on a Sun server using ksh.
I am running a Veritas Cluster Software (High Availablity) command to obtain a group status and grepping the command output for status "G" which means that the filesystem is frozen and therefore not available to... (3 Replies)
Discussion started by: bigbuk
3 Replies
8. Shell Programming and Scripting
We are trying to design a flow so that an ETL job shouldn't start until the previous job completes. The script we have written is
while ; do sleep 2; done
The loop however exits even when the process is actually running. Why could this be happening? (12 Replies)
Discussion started by: jerome_rajan
12 Replies
9. Shell Programming and Scripting
Hi ,
I am processing some files using below shell script the problem for loop exit after processing some files even though it exist.After modifying file.txt and rerunning the script and its running .Any Advise
for i in `cat /xx/file.txt |tr -s "," '\n' ` ; do
echo $i... (3 Replies)
Discussion started by: mohan705
3 Replies
LEARN ABOUT CENTOS
scsi_ch_swp
SCSI_CH_SWP(8) SDPARM SCSI_CH_SWP(8)
NAME
scsi_ch_swp - change SCSI Software WRITE Protect and block device settings
SYNOPSIS
scsi_ch_swp [--help] [--set 0|1] [--verbose] [--wr] BLK_DEVICE
DESCRIPTION
This bash shell script attempts to read or change the Software Write Protect (SWP) bit in the SCSI Control mode page using the sdparm util-
ity. If that change is successful then it uses the blockdev utility to change BLK_DEVICE's read-write or read-only setting in sympathy.
This script is only available in Linux since the blockdev utility is Linux specific.
If changing the SWP bit is supported, setting the SWP bit makes BLK_DEVICE read-only at the device (disk) itself. Clearing the SWP bit
makes BLK_DEVICE read-write which is usually the default setting at device (disk) power up.
If no options are given then the current state of the SWP bit is printed out (using sdparm) together with blockdev's RO bit. If they are
both 1 then BLK_DEVICE is in read-only mode; if they are both 0 then BLK_DEVICE is in read-write mode.
OPTIONS
Arguments to long options are mandatory for short options as well.
-h, --help
print out the usage message then exit.
-s, --set 0|1
when 0 is given then the SWP bit in the Control mode page is cleared (i.e. set that bit to 0) using sdparm; and blockdev is used to
set BLK_DEVICE to read-write mode. When 1 is given then the SWP bit in the Control mode page is set using sdparm; and blockdev is
used to set BLK_DEVICE to read-only mode. The default (i.e. when this option is not given) is to read the state of the SWP bit and
BLK_DEVICE's read-only mode and print those values out.
-v, --verbose
increase level or verbosity.
-w, --wr
when the BLK_DEVICE is in read-only mode, Linux will not typically allow BLK_DEVICE to be opened read-write by sdparm, so the
default action of this script is to use the sdparm --readonly option when --set 0 has been invoked. It is possible that BLK_DEVICE
could be a generic device (e.g. /dev/sg3) which has a different interpretation of the read-only open flag and may fail. For such
rare cases the --wr option makes sdparm open BLK_DEVICE read-write when --set 0 is invoked.
EXIT STATUS
The exit status of this script is 0 when it is successful. Otherwise the exit status is that of the sdparm or the blockdev utility, which-
ever is called last. See the sdparm(8) man page.
AUTHORS
Written by D. Gilbert
COPYRIGHT
Copyright (C) 2013 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
POSE.
SEE ALSO
sdparm(sdparm), blockdev(8)
sdparm-1.08 May 2013 SCSI_CH_SWP(8)