How to start xterm in a directory containing .rvmrc file [closed] - rvm

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
Preface: I'm writing a tmuxinator clone based for i3, and I'm a zsh user.
I want to open a xterm window (or any other terminal) in a given directory, where a .rvmrc file is present, and launch a (ruby-related) command.
Here an example scenario:
➜ /tmp irb
2.0.0p0 :001 >
➜ /tmp cat r/.rvmrc
rvm --create use 1.9.3#cloudflo-cfu
➜ /tmp cd r
Using /home/user/.rvm/gems/ruby-1.9.3-p392 with gemset cloudflo-cfu
➜ r irb
1.9.3p392 :001 >
As you can see I'm using 2.0.0 as system ruby, and 1.9.3 in the r/ direcotry.
I want, from some other place, launch an xterm window in that directory run irb and keep the terminal after that.
From a console I can do:
➜ /tmp (cd /tmp/r && xterm -e "irb ; $SHELL ")&
This will work but the rvm load is done from the current terminal, and this trick cannot be done from a script:
➜ /tmp cat test/start1.sh
(cd /tmp/r && xterm -e "irb ; $SHELL ")&
➜ /tmp ./test/start1.sh
This will open irb in the 2.0.0 version.
So, how do I achieve this?
More in detail, what I'm trying to do is to spot the correct command message for i3-msg utility (that I'm using via i3-py binding uwing i3.exec().
The result should do the following things:
Start a terminal (xterm preferably)
go to a given directory having rvm function loaded (or a workaround for the cd wrapper function of rvm)
launch a command (irb is fine for testing)
launch $SHELL to prevent the terminal to be closed once exiting from irb

this command should do it:
( cd /tmp/r ; xterm -e $SHELL -l -c "irb ; $SHELL" )&
it will change to the directory, start xterm with running login(-l) shell($SHELL) in it and asking it to execute(-c) irb

Related

Windows 11 Ubuntu WSL2 - Autostarting services with /etc/wsl.conf doesn't work [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 12 months ago.
Improve this question
I'm attempting to start docker and postgresql automatically with my ubuntu wsl2 instance. I read about the /etc/wsl.conf configuration file and it only starts one service, not two. For example if I have:
[boot]
command = service docker start
and restart wsl.. I get the following:
mryan ~ $service docker status
* Docker is not running
mryan ~ $service postgresql status
12/main (port 5432): online
Again, if I remove the last line from etc/wsl.conf and restart wsl. Docker starts just fine. I've also tried quotes around the commands as in command="service docker start" but it didn't make a difference. Is there some format error I'm making here? Any help would be appreciated. I can get around this by manually starting services but it would be nice to make things work properly!
Try combining the commands into a single line maybe, with &&.
One still can start it on demand, eg. with .bashrc or .zshrc:
RUNNING=`ps aux | grep dockerd | grep -v grep`
if [ -z "$RUNNING" ]; then
sudo dockerd > /dev/null 2>&1 &
disown
fi
This may require group docker:
sudo usermod -a -G docker $USER

ssh tmux: execute long running command using ssh programmatically [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I need to programmatically execute long running script on a remote server. I tried to use ssh with screen or tmux and so far I could not make it work.
With tmux I managed to make it work when typing the ssh command from my local machine terminal:
ssh <server_name> -t -t tmux new -s my_session \; set-buffer "bash my_script.sh" \; paste-buffer \; send-keys C-m \; detach
But if I run this programmatically I get this error:
open terminal failed: missing or unsuitable terminal: unknown
Connection to <server_name> closed
Use the -d flag to new-session to start tmux detached. So:
ssh <server_name> tmux new -ds my_session \; send-keys "bash my_script.sh" C-m

Removing Odoo 9 from Ubuntu 14.04 desktop? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I want to uninstall Odoo 9 and reinstall in my linux system. Can anyone please help me?
Just follow these steps
service odoo-server stop
Remove config file(s)
rm -f /etc/odoo-server.conf
rm -f /etc/odoo.conf
Remove application code
rm -R /opt/odoo
Remove startup process
update-rc.d -f odoo-server remove
rm -f /etc/init.d/odoo-server
Remove logs
rm -R /var/log/odoo
Remove databases
sudo service postgresql stop
apt-get remove postgresql -y
apt-get --purge remove postgresql\* -y
rm -r -f /etc/postgresql/
rm -r -f /etc/postgresql-common/
rm -r -f /var/lib/postgresql/
Delete users and groups
userdel -r postgres
groupdel postgres
To Remove postgre
find the file pg_hba.conf - it may be located, for example in /etc/postgresql-9.1/pg_hba.conf.
cd /etc/postgresql-9.1/
Back it up
cp pg_hba.conf pg_hba.conf-backup
place the following line (as either the first uncommented line, or as the only one):
local all all trust
restart your PostgreSQL server (e.g., on Linux:)
sudo /etc/init.d/postgresql restart
you can now connect as any user. Connect as the superuser postgres (note, the superuser name may be different in your installation. In some systems it is called pgsql, for example.)
psql -U postgres
Reset password
ALTER USER my_user_name with password 'my_secure_password';
Restore the old pg_hba.conf as it is very dangerous to keep around
cp pg_hba.conf-backup pg_hba.conf
restart the server, in order to run with the safe pg_hba.conf
sudo /etc/init.d/postgresql restart

Unable to run sshpass command in centOS [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Have work on CentOS release 6.3 (Final) system. And try to ssh another machine using sshpass utility like
sshpass -p 'password' ssh user#host
But it give me error like
sshpass: Failed to run command: No such file or directory
So from error i think that sshpass may be not install so have try to install it by yum install sshpass and get following log
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.leapswitch.com
* epel: epel.mirror.net.in
* extras: mirror.leapswitch.com
* nux-libreoffice.org-rpms: mirror.li.nux.ro
* updates: mirror.leapswitch.com
Setting up Install Process
Package sshpass-1.05-1.el6.i686 already installed and latest version
Nothing to do
from above it seems sshpass is already installed.So why it not working?
Check if your shell knows the locations of sshpass
which sshpass
If it doesnt give any output use find command to find the location of the executable:
find / -name sshpass
If you find the path, you can either use the full path of the executable:
/path/to/sshnpass
Or add the path to the PATH environmental variable, so that your shell can locate it:
export PATH=$PATH:/path/to/
Or the issue might be completely different. sshpass might not be able to find some other dependency. "ssh" client might not be installed. Or your syntax might be wrong:

Error when using scp command "bash: scp: command not found" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 6 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I want to use scp command to copy a local file to remote server, but I get an error message after input the password of user in remote server.
~]$ scp gitadmin.pub git#123.150.207.18:
git#123.150.207.18's password:
bash: scp: command not found
lost connection
I checked on server using the git user and it seems the scp command can be found and openssh-clinets were installed too.
git#... ~]$ scp
usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[-l limit] [-o ssh_option] [-P port] [-S program]
[[user#]host1:]file1 ... [[user#]host2:]file2
git#... ~]$ su root
......
root#... ~]# yum info openssh-clients
Loaded plugins: product-id, subscription-manager
Updating Red Hat repositories.
Installed Packages
Name : openssh-clients
Arch : x86_64
Version : 5.3p1
Release : 52.el6
Size : 1.0 M
Repo : installed
From repo : anaconda-RedHatEnterpriseLinux-201105101844.x86_64
Summary : An open source SSH client applications
URL : http://www.openssh.com/portable.html
License : BSD
Description : OpenSSH is a free version of SSH (Secure SHell), a program for
: logging into and executing commands on a remote machine. This
: package includes the clients necessary to make encrypted
: connections to SSH servers.
I'm confused for the situation. Did I missing some configuration on server? (We are using RHEL6 as server.)
It's my fault in path setting.
I added 'custom.sh' in /etc/profile.d and added following lines in it to add /usr/local/node/bin directory to PATH.
export PATH="/usr/local/node/bin:$PATH"
But the format is wrong. I removed the pair of '"' and it works OK now. It should be:
export PATH=$PATH:/usr/local/node/bin
A probe mistake...^_^
Make sure the scp command is available on both sides - both on the client and on the server.
If this is Fedora or Red Hat Enterprise Linux and clones (CentOS), make sure this package is installed:
yum -y install openssh-clients
If you work with Debian or Ubuntu and clones, install this package:
apt-get install openssh-client
Again, you need to do this both on the server and the client, otherwise you can encounter "weird" error messages on your client: scp: command not found or similar although you have it locally. This already confused thousands of people, I guess :)
Issue is with remote server, can you login to the remote server and check if "scp" works
probable causes:
- scp is not in path
- openssh client not installed correctly
for more details http://www.linuxquestions.org/questions/linux-newbie-8/bash-scp-command-not-found-920513/
Check if scp is installed or not on from where you want want to copy
check using which scp
If it's already installed, it will print you a path like /usr/bin/scp
Else, install scp using:
yum -y install openssh-clients
Then copy command
scp -r root#192.168.1.1:/var/www/html/database_backup/restore_fullbackup/backup_20140308-023002.sql /var/www/html/db_bkp/