Sponsored Content
Top Forums Shell Programming and Scripting Will the continue function work ???? Post 86128 by kamlesh_p on Tuesday 11th of October 2005 11:21:13 AM
Old 10-11-2005
Will the continue function work ????

I have written a script which does a following functions:-
1) Check a area if it is mounted or not
2) If the area is not mounted it will prompt the user to mount the are.
3) Once the area is mounted and the option is given as Y or y
the script continues...
My question is will the below script function properly with the above condition.
I am not sure of the continue option.
==========================
umount_snap()
{
$ECHO "Umounting online $SNAPSHOT"
$FUSER -cku $SNAPSHOT
$JFSUMOUNT $SNAPSHOT
if [ $? -eq 0 ]
then
echo "success ..."
else
echo "error .."
fi
}


check_mount()
{
$BDF |$GREP $SNAPSHOT
if [ $? -eq 0 ]
then
umount_snap
else
$ECHO "The $SNAPSHOT is not mounted pls mount the same : \c"
$ECHO "Do you want to continue : Y/N "
read key
if [ "$key" = "Y" -o "$key" = "y" ]
then
continue
else
exit 1
fi
fi
}


SNAPSHOT=/snapshot/tan
ECHO=/usr/bin/echo
FUSER=/usr/bin/fuser
JFSUMOUNT=/TEST/UCS/CONTROL/scripts/jfsumount
RM=/usr/bin/rm
BDF=/usr/bin/bdf
## Main script starts here
check_mount
 

10 More Discussions You Might Find Interesting

1. Web Development

work with date function

hi, how can i can pass the value of unixformat to date/time? and how can i retrieve the day/month/year from a date? thanks a lot for your help ps:i using php (1 Reply)
Discussion started by: jasonx22
1 Replies

2. Programming

why printf() function don't go work?

I use FreeBSD,and use signal,like follows: signal(SIGHUP,sig_hup); signal(SIGIO,sig_io); when I run call following code,it can run,but I find a puzzled question,it should print some information,such as printf("execute main()") will print execute main(),but in fact,printf fuction print... (2 Replies)
Discussion started by: konvalo
2 Replies

3. Shell Programming and Scripting

Cannot get grep to work within function.

Hello again, Am having an issue now with getting a simple grep command to work within a function.. The function is as below... function findRecord() { output=grep "001" recordDatabase echo $output } At the moment the "001"... (3 Replies)
Discussion started by: U_C_Dispatj
3 Replies

4. UNIX for Dummies Questions & Answers

copy *. does not work in function

Hi, I want to copy a file/directory ( recursively , if needed) and if destination directory does not exist create it ( with parent directory, if needed). funcopy () { if ; then echo "$2 exists , copying files" cp -r "$1" "$2" else echo "Directory does not exist;Create directory" mkdir... (1 Reply)
Discussion started by: greet_sed
1 Replies

5. Shell Programming and Scripting

How the Sleep function will work?

Hi All, I am new to Unix , there i am facing one problem with sleep command. that is .. in while loop i have defined sleep function .. my condition is like this while #i knew this is infinite loop do sleep 200 echo "hello " done. this condition will never become .. true... (3 Replies)
Discussion started by: mandlysreedhar
3 Replies

6. Shell Programming and Scripting

Why double quotation marks doesn't work in ksh function parameters passing?

I'm working on AIX 6, ksh shell. The parameters are some strings quotated by double quotation marks which from a file. They are quotated because there may be spaces in them. Example: "015607" "10" " " "A"I want to pass these parameters to a shell function by writing the following command: ... (4 Replies)
Discussion started by: Shimmey
4 Replies

7. Shell Programming and Scripting

Function doesn't work

Hello, and here's my problem: I can't get my function to do what I want. When I call my function get_from_A_to_F I give it an argument $remainder. I want my function to substitute a number higher than 9 to a specific letter. If the argument is equal to 10 than it should change it to "A".... (8 Replies)
Discussion started by: linas
8 Replies

8. Shell Programming and Scripting

Flock preventing function to work

Hi i have a script that check pings and i use flock to so the script wont run multipul times : its not the whole script but this is the idea : ( flock -x -w 3 200 || exit 1 /usr/sbin/fping -c$count -i$interval -a $hosts > $FILE1 2>&1 ) 200>/var/lock/.myscript.exclusivelock now i... (4 Replies)
Discussion started by: batchenr
4 Replies

9. UNIX for Beginners Questions & Answers

UNIX/Shell function does not work as wished

Hello everyone I really hope you can help me, I can't continue: Im on a project to work with my Server. I wanted to put on my server all data-systems and I did this: df -h The output is a string. How can I turn the string into a table? Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf... (5 Replies)
Discussion started by: anonymuser
5 Replies

10. OS X (Apple)

'time' does NOT work on a function in 'dash'.

Hi guys and gals... I am writing a piece of code that is dash compliant and came across this error. I have put it in the OSX section as that is what I am using. I have no idea what the 'dash' version is but was installed about 6 months ago. MBP, OSX 10.12.6, default terminal running dash on... (4 Replies)
Discussion started by: wisecracker
4 Replies
SET 
TRANSACTION(7) PostgreSQL 9.2.7 Documentation SET TRANSACTION(7) NAME
SET_TRANSACTION - set the characteristics of the current transaction SYNOPSIS
SET TRANSACTION transaction_mode [, ...] SET TRANSACTION SNAPSHOT snapshot_id SET SESSION CHARACTERISTICS AS TRANSACTION transaction_mode [, ...] where transaction_mode is one of: ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } READ WRITE | READ ONLY [ NOT ] DEFERRABLE DESCRIPTION
The SET TRANSACTION command sets the characteristics of the current transaction. It has no effect on any subsequent transactions. SET SESSION CHARACTERISTICS sets the default transaction characteristics for subsequent transactions of a session. These defaults can be overridden by SET TRANSACTION for an individual transaction. The available transaction characteristics are the transaction isolation level, the transaction access mode (read/write or read-only), and the deferrable mode. In addition, a snapshot can be selected, though only for the current transaction, not as a session default. The isolation level of a transaction determines what data the transaction can see when other transactions are running concurrently: READ COMMITTED A statement can only see rows committed before it began. This is the default. REPEATABLE READ All statements of the current transaction can only see rows committed before the first query or data-modification statement was executed in this transaction. SERIALIZABLE All statements of the current transaction can only see rows committed before the first query or data-modification statement was executed in this transaction. If a pattern of reads and writes among concurrent serializable transactions would create a situation which could not have occurred for any serial (one-at-a-time) execution of those transactions, one of them will be rolled back with a serialization_failure error. The SQL standard defines one additional level, READ UNCOMMITTED. In PostgreSQL READ UNCOMMITTED is treated as READ COMMITTED. The transaction isolation level cannot be changed after the first query or data-modification statement (SELECT, INSERT, DELETE, UPDATE, FETCH, or COPY) of a transaction has been executed. See Chapter 13, Concurrency Control, in the documentation for more information about transaction isolation and concurrency control. The transaction access mode determines whether the transaction is read/write or read-only. Read/write is the default. When a transaction is read-only, the following SQL commands are disallowed: INSERT, UPDATE, DELETE, and COPY FROM if the table they would write to is not a temporary table; all CREATE, ALTER, and DROP commands; COMMENT, GRANT, REVOKE, TRUNCATE; and EXPLAIN ANALYZE and EXECUTE if the command they would execute is among those listed. This is a high-level notion of read-only that does not prevent all writes to disk. The DEFERRABLE transaction property has no effect unless the transaction is also SERIALIZABLE and READ ONLY. When all three of these properties are selected for a transaction, the transaction may block when first acquiring its snapshot, after which it is able to run without the normal overhead of a SERIALIZABLE transaction and without any risk of contributing to or being canceled by a serialization failure. This mode is well suited for long-running reports or backups. The SET TRANSACTION SNAPSHOT command allows a new transaction to run with the same snapshot as an existing transaction. The pre-existing transaction must have exported its snapshot with the pg_export_snapshot function (see Section 9.26.5, "Snapshot Synchronization Functions", in the documentation). That function returns a snapshot identifier, which must be given to SET TRANSACTION SNAPSHOT to specify which snapshot is to be imported. The identifier must be written as a string literal in this command, for example '000003A1-1'. SET TRANSACTION SNAPSHOT can only be executed at the start of a transaction, before the first query or data-modification statement (SELECT, INSERT, DELETE, UPDATE, FETCH, or COPY) of the transaction. Furthermore, the transaction must already be set to SERIALIZABLE or REPEATABLE READ isolation level (otherwise, the snapshot would be discarded immediately, since READ COMMITTED mode takes a new snapshot for each command). If the importing transaction uses SERIALIZABLE isolation level, then the transaction that exported the snapshot must also use that isolation level. Also, a non-read-only serializable transaction cannot import a snapshot from a read-only transaction. NOTES
If SET TRANSACTION is executed without a prior START TRANSACTION or BEGIN, it will appear to have no effect, since the transaction will immediately end. It is possible to dispense with SET TRANSACTION by instead specifying the desired transaction_modes in BEGIN or START TRANSACTION. But that option is not available for SET TRANSACTION SNAPSHOT. The session default transaction modes can also be set by setting the configuration parameters default_transaction_isolation, default_transaction_read_only, and default_transaction_deferrable. (In fact SET SESSION CHARACTERISTICS is just a verbose equivalent for setting these variables with SET.) This means the defaults can be set in the configuration file, via ALTER DATABASE, etc. Consult Chapter 18, Server Configuration, in the documentation for more information. EXAMPLES
To begin a new transaction with the same snapshot as an already existing transaction, first export the snapshot from the existing transaction. That will return the snapshot identifier, for example: BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ; SELECT pg_export_snapshot(); pg_export_snapshot -------------------- 000003A1-1 (1 row) Then give the snapshot identifier in a SET TRANSACTION SNAPSHOT command at the beginning of the newly opened transaction: BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ; SET TRANSACTION SNAPSHOT '000003A1-1'; COMPATIBILITY
These commands are defined in the SQL standard, except for the DEFERRABLE transaction mode and the SET TRANSACTION SNAPSHOT form, which are PostgreSQL extensions. SERIALIZABLE is the default transaction isolation level in the standard. In PostgreSQL the default is ordinarily READ COMMITTED, but you can change it as mentioned above. In the SQL standard, there is one other transaction characteristic that can be set with these commands: the size of the diagnostics area. This concept is specific to embedded SQL, and therefore is not implemented in the PostgreSQL server. The SQL standard requires commas between successive transaction_modes, but for historical reasons PostgreSQL allows the commas to be omitted. PostgreSQL 9.2.7 2014-02-17 SET TRANSACTION(7)
All times are GMT -4. The time now is 07:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy