I am just wondering if there is some command which tells me if I have access to a certain queue on a cluster with sge. Thanks:)
Use qstat's -U option. From the man page for qstat(1):
-U user,...
Displays status information with respect to queues to
which the specified users have access. Status informa-
tion for jobs is displayed either for those which exe-
cute in one of the selected queues or which are pending
and might get scheduled to those queues in principle.
You can then do
$ qstat -U yourusername -g c
to see a list of all the queues you have access to, or
$ qstat -U yourusername -g c -q yourqueuename
to determine if you can access a specific queue(the list will be empty if you do not have access).
Related
I have my ssh private key (/home/user/.ssh/id_rsa) as a volume mounted secret in my container. Kubernetes seems to mount it with uid 0. However, my app runs as a specific user, and therefore can't access the ssh private key whose permission must be 600 at min. How can I change the ownership of my private key to reflect that of a specific user?
thanks.
In Linux, usernames are mapped to a user id which can be seen with the command id -u someusername.
SSH requires by default in many cases that your SSH key be owned by the user running SSH and be hidden to others 600
Therefore, I highly recommend you copy your key instead of mounting it, unless your container user has the same user id as you.
If you are using a linux container, you can run the command inside the container to get the exact user id, and then chown your files with the user id instead of a user name.
kubectl exec -it mypod bash or sh if bash doesn't work
$ id -u someuser
OR
kubectl exec -it mypod id -u if your container has one user which started the main process
THEN
Copy your id file so you can chown it without interfering with your ability to ssh.
mkdir -p /data/secrets/myapp
cp /home/user/.ssh/id_rsa /data/secrets/myapp/id_rsa
chown $MYAPPUSERID:$MYAPPUSERID /data/secrets/myapp/id_rsa
chmod 600 /data/secrets/myapp/id_rsa
Because the host OS might have already mapped this user id, it may seem that your files are owned by another arbitrary user, but what ultimately matters is the user id of the owner/group.
I am working on an IoT device. I have installed Eclipse Kura in raspberry pi 3
to use it as a gateway. I want to publish a message to Kapua server (installed in the same network) using Kura or directly using the raspberry pi. I have tried both methods.
1- Using Kura
I have followed the given instructions on GitHub Kura Kapua connection tutorial #780. After following these steps I am able to establish the Kura Kapua connection but unable to send data, Example.publisher package is also installed in Kura. I want to create a topic and publish data on that topic.
2- Using MQTT-Client library
I have installed the MQTT-Client library in raspberry pi and use the following commands to publish and subscribe the data.
To Publish :
sudo mosquitto_pub -h "broker-URL" -p "Port" -t "topic" -m "message" -u "user-name"-P "user-pass" -i "client-id"
To subscribe :
sudo mosquitto_pub -h "broker-URL" -p "Port" -t "topic" -u "user-name"-P "user-pass" -i "client-id"
this has the same behavior, It also establishes the connection but unable to create the topic and publish data.When I do the same for localhost it does send the message. I am using two different terminals to publish and subscribe.
Is there any method or example where I can actually send some data and observe at the other end using Kura or MQTT.
General knowledge
Correct connection parameters (if you followed the tutorial you mentioned) are:
-h localhost
-p 1883
-u kapua-broker
-P kapua-password
(not sure the doublequote is required)
Kapua uses has a specific topic format to grant access control over the topics.
The semantic of the format is:
{account-name}/{client-id/{semantic-topic}
Depending on your privileges you can access different levels of topics.
The defaults user kapua-broker allows only to connect, publish and subscribe under:
{kapua-sys}/{connection-client-id}/#
You need more permissions to subscribe to other client-id topics.
The permission required to do that is:
data:view
Your example
First, it seems that you are using the published to subscribe. This is your command.
sudo mosquitto_pub -h "broker-URL" -p "Port" -t "topic" -u "user-name"-P "user-pass" -i "client-id"
Secondly credential, host, usenrname, password, and topic are all wrong (unless you "obscured" them before publishing to SO).
To make your test work you need to use the following commands,
Subscribe
mosquitto_sub -h "localhost" -p "1883" -t "kapua-sys/mosquitto_pub/my/test/topic" -u "kapua-sys" -P "kapua-password" -i "mosquitto_sub"
Publish
mosquitto_pub -h "localhost" -p "1883" -t "kapua-sys/mosquitto_pub/my/test/topic" -m "My test message" -u "kapua-broker" -P "kapua-password" -i "mosquitto_pub"
For the Kura example publisher, I don't know where could be the problem, due to lack of info. I'm assuming you are publishing or subscribing to a topic you cannot access to due to write/read permission on topics.
Hope that this help! :)
I would like to know if its possible to list the message_unacknowledged of specific queue ? I mean I have a 4-5 queue in 1 vhosts but I want to check the message_unacknowledged for specific queue only.
Here is my command:
C:\Python26\python.exe C:\Python26\rabbitmqadmin.exe --host %host% --port 443 --ssl --user %user% --password %password% list queues messages_unacknowledged
Output:
Output of with name
Here is what I want to see only.
enter image description here
Thanks!
If you run this command
C:\Python26\python.exe C:\Python26\rabbitmqadmin.exe help subcommands
It will show all the commands that you can run.
Unfortunately you cannot get the count of messages for a specific queue.
But you can write a script to hit this url which will return a Json with all the details about the queue
http://username:password#queue-server:15672/api/queues/%2f/queue_name
I have a 2 node system running pacemaker, corosync and postgresql 9.4. I am carrying out pgsql replication using virtual IP and am able to successfully recover a downed machine using manual commands. Now to automate stuff, I want to run the following commands in a script to get my recovered master back on cluster.
`#su -postgres
$rm -rf /var/lib/pgsql/9.4/data/* //To delete old data files
$pg_basebackup -h 192.XX.XX.XX -U postgres -D /var/lib/pgsql/9.4/data -X stream -P // To recover the latest data from standby PC running latest entries
$rm /var/lib/pgsql/tmp/PGSQL.lock
$exit //exit from postgresql shell
#pcs resource cleanup msPostgresql`
Now when i run these commands as a script, it hangs after the first command itself i.e. su -postgres and the cursor blinks at bash$ syntax without inserting the commands down below.
I want to automate this process using cron but the script itself is not working for me. Can someone help me out here.
Regards
As far as I know "su -postgres" is wrong. You can use either "su postgres", or "sudo -i -u postgres"
Regarding the scripts here you can find tested, working scripts. The one you are interested in is called "initiate_replication.sh" there.
I have PostgreSQL 9.4(not installed, rather self configured) which is also installed as a Windows service. Now I am trying to check the status of the server using pg_ctl.exe status -D data_dir_path, but it only shows the status when I start the console as admin.
My final goal is to be able to shutdown/ start the database server without admin rights. Is it possible to configure PostgreSQL so that I can start/stop the servers locally without admin rights?
As far I read in the PostgreSQL documentation, the services can be registered to a user using [-U username] [-P password] arguments but I am not sure whether this is the database user or the local windows user. I tried registering the service using the following code but it does not install it. And I do not see any logs too. The commnd follows:
pg_ctl.exe register -N service_name -U database_user -P database_user_password -D data_dir_path -S auto -o "-p port"
Thanks in advance