Skip to content
Tcl Source Code View Ticket
Login

View Ticket

bug on exec command

Closed / Fixed218180ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:54:12
OriginalBugID: 2331 Bug
Version: 8.1
SubmitDate: '1999-07-06'
LastModified: '1999-12-03'
Severity: MED
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Solaris
OSVersion: SunOS iplannet 5.5.1 Generic_103640-12 sun4u sparc SUNW,Ultra-2
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '1999-12-03'


Name:
Alberto Franco de Sa Ribeiro

Extensions:
scotty

CustomShell:
tcl core configured with --prefix=/opt/SCRtcl

ReproducibleScript:
When I start a daemon (PostgreSQL) on a script file, it never finish. The
same exec works when I try to use in a interactive shell.
My script:

#!/opt/SCRtcl/bin/tclsh

set env(PGLIB) /opt/PostgreSQL/lib
set env(PGDATA) /opt/PostgreSQL/data

switch -exact [lindex $argv 0] {
   start {
       if {! [catch { exec su pgsql -c  "/opt/PostgreSQL/bin/postmaster -b /opt/PostgreSQL/bin/postgres -D
                /opt/PostgreSQL/data -S -o -e" }]} {
           puts "PostgreSQL iniciado corretamente"
       } else {
           puts "Falha na inicializacao do PostgreSQL"
       }
       # Bug do tcl: processos em background impedem shell de terminar
       exec kill -HUP [pid]
   }
   stop  {
       if [catch {set l1 [split [exec /usr/ucb/ps -aux | /usr/bin/grep "^pgsql"] \n]}] {
           puts "Nao foi encontrado nenhum processo do usuario pgsql"
       } else {
           foreach l $l1 {
               set pid [lindex [split $l] 5]
               if {! [catch {exec kill -INT $pid}]} {
                   puts "Enviado sinal INT ao pid $pid"
               }
           }
       }
   }
   default {
       puts "utilize: $argv0 (start|stop)"
   }
}
# end of script

PS: tkined is also not finishing.

DesiredBehavior:
scripts finishing when there are no more commands



The user should verify that the same commands are really being
called.  In an interactive shell, the 'unknown' command will kick
in when something is not recognized.  The behavior is different
in a standard script. 
-- 12/03/1999 hobbs
welch Closed ticket [218180ffff]. [History diff]2000-10-26 08:16:55
dgp Ticket [218180ffff]: 3 changes [History diff]2001-04-05 08:20:14
Log in (anonymous is fine) to add a comment.