Auto input Username and Password in Redhat

55 Views Asked by At

Iam newbie in linux, and i've looking for this solution but i still cannot doing it. I want to backup my database automatically every week by entering the command into the cronjob. But when the command is executed automatically, it will ask for username and password and it becomes not automatic coz user should entering it manually. How do I input the username and password automatically?

The prompt is: GSQL username: then GSQL password:

Thank you

1

There are 1 best solutions below

1
On BEST ANSWER

Cron command should be like:

GSQL_USERNAME='actualUsername' GSQL_PASSWORD='actualP@ssw0rd' gbar backup

or

export GSQL_USERNAME='actualUsername' && export GSQL_PASSWORD='actualP@ssw0rd' && gbar backup

These command lines set Environment variables first and then runs backup command.

Details here:

You can specify the number of parallel processes for backup and restore.

You must provide the username and password using GSQL_USERNAME and GSQL_PASSWORD environment variables.

GSQL_USERNAME=tigergraph GSQL_PASSWORD=tigergraph gbar backup -t daily