Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psql command does not work #7

Open
paulopastoriza opened this issue Oct 24, 2016 · 0 comments
Open

psql command does not work #7

paulopastoriza opened this issue Oct 24, 2016 · 0 comments

Comments

@paulopastoriza
Copy link

Hi,

1) The line below does not work in bash:

P) sql="PGPASSWORD=$baculaDbPass /usr/bin/psql -h$baculaDbAddr -p$baculaDbPort -U$baculaDbUser -d$baculaDbName -c" ;;

Error output:

++ 'PGPASSWORD=password' /usr/bin/psql -hserver -p5432 -Ubacula -dbacula -c 'select Type from Job where JobId=325;'
/var/spool/bacula/bacula-zabbix.bash: linha 22: PGPASSWORD=password: comando não encontrado
+ baculaJobType=
+ '[' '' '!=' B ']'
+ exit 9

Correction:

P) sql="env PGPASSWORD=$baculaDbPass /usr/bin/psql -h$baculaDbAddr -p$baculaDbPort -U$baculaDbUser -d$baculaDbName -c" ;;

2) It is also necessary to adjust the psql command:

+ case $baculaDbSgdb in
+ sql='env PGPASSWORD=password /usr/bin/psql -hserver -p5432 -Ubacula -dbacula -c'
++ env 'PGPASSWORD=password' /usr/bin/psql -hserver -p5432 -Ubacula -dbacula -c 'select Type from Job where JobId=325;'
+ baculaJobType=' type
------
B
(1 registro)'
+ '[' ' type
------
B
(1 registro)' '!=' B ']'
+ exit 9

Correction:

P) sql="env PGPASSWORD=$baculaDbPass /usr/bin/psql -h$baculaDbAddr -p$baculaDbPort -U$baculaDbUser -d$baculaDbName -t -A -c" ;;

-A
--no-align
Switches to unaligned output mode. (The default output mode is otherwise aligned.)

-t
--tuples-only
Turn off printing of column names and result row count footers, etc. This is equivalent to the \t command.

@paulopastoriza paulopastoriza changed the title psql command not function psql command does not work Oct 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant