Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm trying to get into tar file the stdout generated from Mysqldump:
mdm#deb606:~$ mysqldump --opt test1 -u root -ppassword | tar -czf example.tar.gz
doesn't work.
At the moment I've temporary solved using:
mdm#deb606:~$ mysqldump --opt test1 -u root -ppassword | gzip -f > example.gz
Is it possible do the the same using also tar or bzip2?
I don't know that it's possible to pipe directly into tar (in general, that doesn't make a lot of sense), however the bzip2 command will accept - to mean to read from stdin, i.e.:
mdm#deb606:~$ mysqldump --opt test1 -u root -ppassword | bzip2 - > example.bz2
Related
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
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
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
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am currently in public_html dir and when executing
rm filename.php
it removes only that file in public_html dir ,
but in over 80 sub dirs I have and also need to remove the same file .
What would command be for that?
Assuming the fully qualified name of the directory, how about:
find /var/public_html -name "filename.php" -exec rm -rf {} \;
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
So this command will replace abc with XYZ in file.txt in directory tmp
sed -ie 's/abc/XYZ/g' /tmp/file.txt
How do you do a find and replace like this across a large number of files in a directory with a .html extension in one go?
find /start/path -name *.html -exec sed -ie 's/abc/XYZ/g' '{}' \;
As by your request, here is what it does:
find /start/path -name *.html
Finds all files that glob to *.html, starting in /start/path
The -exec option tells find, to not just print out the files, but to run a command on them. Inside this command {} is replaced by the file. The -exec option hast to end with a semicolon, which we have to escape with a backslash, else bash will swallow it.
Again, from the OP's special situation: Put the following into a file called replaceabc.sh
#!/bin/bash
find '/home/129224/domains/sandpit.uk-cpi.com/html/sshit' -name '*.html' -exec sed -ie 's/abc/XYZ/g' '{}' \;
then from the shell prompt
chmod 700 /path/to/replaceabc.sh
/path/to/replaceabc.sh