Running a script in EMS - tibco

I tried to get the ACLs of Q n Topics but one by one.
Can we run a script in EMS to get the ACLs of required queues r topics into a file.?
Thanks in advance.
Regards,
Vijay

Create a text file with all your commands in it with each command on a new line.
example myscript.txt
showacl queue queue1
showacl queue queue2
On command line navigate to ems bin directory and call tibemsadmin executable with -script parameter and pass above created text file. example:
tibemsadmin -server tcp://localhost:7222 -script myscript.txt -user user -password pwd
The output would be shown on console you can redirect it to a text by appending >out.txt to above command.
*Don't forget to update the correct EMS server, username and password in the command.

If you have access to the EMS installation directory, then you can get the required details directly from the acl.conf file available in the installation directory.

Related

Is there a way to run one bash file which executes commands in local and server terminal also

I am running the bash files to make a Mongo dump on daily bases.But In local directory I am running a one bash file which connects to server terminal.And in server terminal I am running the other file which makes a Mongo dump.
But is it possible to make one file which connects to MongoDB server terminal and run the commands on the sever.
I tried with many commands but it was not possible to run the commands on the server terminal with one bash file, when the server terminal opens up then the left over commands does not execute.
Is it possible to do one bash file and execute the server commands on the server..?
Connect to your DB remotely using this command :
mongo --username username --password secretstuff --host YOURSERVERIP --port 28015
You can then automate this by including your pertaining commands ( including the above ) in a bash script that you can run from anywhere.
To solve the above problem, answer from Matias Barrios seems to be correct for me. You don't use a script on the server, but use tools on your local machine that connect to the server services and manage them.
Nevertheless, to execute a script on a distant server, you could use ssh. This is not the right solution in your case, but answer the question in your title.
ssh myuser#MongoServer ./script.sh param1
This can be used in a local script and execute script.sh on the server MongoServer (with param1 and) with system privileges of the user myuser.
Beforehand, don't forget to avoid password request with
ssh-copy-id myuser#MongoServer
This will copy your ssh public key in the myuser directory of the MongoServer

psql asks for password and does not read from pgpass.conf

I have installed my Postgresql database on a Windows server environment. I'd like to schedule a job using Windows Task scheduler to run every night so I need to run the following command without asking for password:
psql -U myUserName-d myDBName -c "select MyFunctionName()"
When I run the above query in my cmd shell, it asks me for password. When I enter the password manually, the function is correctly run.
So my solution is to read from the pgpass.conf file so no password is required.
Here are the things I have done to achieve this:
I created the pgpass.conf file in a directory I created in the %appdata% (AppData\Roaming\postgresql to be precise).
Here are the contents of this file:
localhost:5432:myDBName:myUserName:myPassword
I have also tried with the value 127.0.0.1 instead of localhost above.
I, then, added the an environment variable (in the user variables for administrator list) called PGPASSFILE and gave it the pgpass.conf location.
;C:\Users\administrator\AppData\Roaming\postgresql\pgpass.conf
Finally I stopped and restarted my Postgres service on Windows services and re-ran the command. But it is still asking for password.
How can I let my command know from where to read the password?
If you don't want to set the PGPASSFILE environment variable, put the password file in the standard location %APPDATA%\postgresql\pgpass.conf as described by the documentation.

How to take queuemanager backup and restored in linux

Hello I have queue manager with name QM_1. Here I have taken backup of QM_1 like following.
after that I created queue manager(QM_1) with same name in other system and I need to restore the save qmgr properties. Pls provide how to restore the queuemanager properties?
saveqmgr -m QM_1 -f
Some of the options are are on the SupportPac MS03 landing page. (MS03 is the SupportPac that contains the saveqmgr program.) Detailed instructions are in the download documentation. The following instructions are copied from the SupportPac MS03 page:
You can run the following saveqmgr command (see below) to create 2 output files. Both output files are text and they can be edited.
one with the object definitions (using option -f) - the file name in this example is: qmgr_data.mqsc
the other with the authority records (using option -z which generates entries for setmqaut)
the file name in this example is: qmgr_auth.bat (in Windows) or qmgr_auth.sh (in UNIX)
The following command saves both the objects and the authority records:
UNIX:
saveqmgr -m QMGR -f /tmp/mq/qmgr_data.mqsc -z /tmp/mq/qmgr_auth.sh
Windows:
saveqmgr.exe -m QMGR -f C:\temp\mq\qmgr_data.mqsc -z C:\temp\mq\qmgr_auth.bat
The file qmgr_data.mqsc can be run as follows when trying to restore the contents into a new queue manager:
runmqsc TEST < qmgr_data.mqsc
The file qmgr_auth.bat (in Windows) or qmgr_auth.sh (in UNIX) has stand-alone entries that invoke the setmqaut command with the proper parameter for each authority record. This batch/script file will need to be executed in order to restore the authority records.
UNIX:
chmod u+x qmgr_auth.sh
./qmgr_auth.sh
Windows:
qmgr_auth.bat
To find this and all the other SupportPacs, go to the SupportPac landing page here.
Update 6 November 2014:
Although OP asked how to restore from a saveqmgr backup, it is worth noting that IBM has provided the dmpmqcfg command beginning with version 7.1. You can back up the QMgr in MQSC format using this syntax:
dmpmqcfg -m [QUEUE_MANAGER] > BACKUP_FILE.mqsc
This captures the object deinifions and the authorizations in a single file. The authorizations are captured as SET AUTHREC entries rather than as setmqaut commands by default.
Please note that the initial versions of dmpmqcfg did not capture all of the authorization settings that you might have defined. It is necessary for all versions to apply the latest Fix Pack to get a reliable backup using dmpmqcfg. This behavior may regress in later Fix Packs so it is advisable to reconcile your backup against your auths creation script when switching to this command and after applying a Fix Pack.
Restore a QMGgr from the dmpmqcfg file the same as you would from the saveqmgr file:
runmqsc [QMNAME] < output_of_dmpmqcfg_or_saveqmgr.mqsc > logfile.txt 2>&1
This runs the MQSC file definitions into the QMgr (including SET AUTHREC commands) and saves the output of STDOUT and STDERR to a log file.

mget prompt override

I am using ftp in the command line (terminal) to transfer multiple data files from a remote server to my local computer. There are multiple files (~40) in the directory and I would like to transfer them all without having to answer yes in the prompt for each file. I tried mget * but this only transferred the first file and then a prompt popped up for the second file.
Issue a prompt command first to turn interactive prompting off.
Alternatively, if you have control over the way the ftp command is called, use the command line option, as suggested by #reg-edit:
ftp [-i | --no-prompt] [OPTIONS] [HOST [PORT]]
As an alternative to issuing a prompt command ahead of your other commands, you may invoke ftp with the -i switch.
When you already started ftp you can issue the prompt command to toggle between getting prompted and not getting prompted. So this should do the trick:
> ftp <some server>
ftp> prompt
Interactive mode OFF .
ftp> mget *

Batch script connect to ftp sever?

I am trying to connect to my ftp server by running a batch script. I can log into it fine by typing the following:
ftp home.ptd.net
USERNAME
PASSWORD
cd Public
put FILENAME.txt
bye
But if I put this into a script in this order, it connects to the server, but still asks for a username. Can anyone point me in the right direction on how to make it login? Thanks.
please see the following msdn article:
ftp reference from msdn
i think you need to place the commands in a text file and pass it to the ftp command with the -s parameter

Resources