Home > Software engineering >  Auto input Username and Password in Redhat
Auto input Username and Password in Redhat

Time:01-25

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

CodePudding user response:

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

  • Related