>In bash i have:
>
>#case $1 in
>#  start)
>#       $ECHO_N "Starting PostgreSQL: "$ECHO_C
>#       su - $PGUSER -c "$DAEMON -D '$PGDATA' &"
>>>$PGLOG 2>&1
>#       echo "ok"
>#       ;;
>
>In perl, How I to build it ?
>

How about this?

if ($ARGV[0] eq 'start') {
    print "Starting PostgreSQL:\n";
    unless (fork) {
        exec "su - $PGUSER -c \"$DAEMON -D \'$PGDATA\' ";
    }else {
         print "ok\n";
         exit;
    }

} elsif ($ARGV[0] eq 'stop') {
    ....
}

Perl doesn't have the "switch" control statement.
But you can get it by looking at CPAN:
http://search.cpan.org/~rgarcia/Switch-2.13/Switch.pm

--
mailto: [EMAIL PROTECTED]
http://home.arcor.de/jeffpang/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to