Introduction
we can use the asadmin
utility to perform administrative tasks for Oracle GlassFish Server from the command line or from a script.
Path to the asadmin Utility
The asadmin utility is found in the glassfish installation directory
${glassfish_install}/bin/asadmin
asadmin>
Upon running the command you enter the asadmin>
console which enables to perform various administrative tasks
Inorder to run any command the adadmin
utility will ask admin username and password
adadmin>asadmin list-applications
Enter admin user name> admin
Enter admin password for user "admin">
The commands are executed once the username and password is validated
Change The admin Password
To change the admin password run the following command
asadmin> change-admin-password --user admin
asadmin login without password
If we want automated scripts to handle various administrative task we need that password need not be entered from stdin
Instead of typing the password at the command line, you can access the password for a command from a file such as passwords.tx
t.
The --passwordfile
option of the asadmin
utility takes the name of the file that contains the passwords.
The entry for a password in the file must have the AS_ADMIN_ prefix followed by the password name in uppercase letters.
Example password file is as follows:
AS_ADMIN_ prefix=1234
For example to run deploy command via scripts we can execute
./asadmin deploy $war --user admin --passwordfile /opt/password.txt
References
- http://ufasoli.blogspot.in/2013/07/glassfish-asadmin-without-password.html
- http://docs.oracle.com/cd/E19776-01/820-4495/ghytn/index.html
- https://docs.oracle.com/cd/E19798-01/821-1751/giobi/index.html