Help - Search - Members - Calendar
Full Version: SSH Shell HELP!!
Hostony Board > General Support > General Support
wendas
Ok I by suggestion I got SSH Shell

and I was given 2 basic syntax, but with the eternally black nasty looking screen this is not enough to help me know what I am doing.

Can anyone write me a simple example of how to backup & restore my database
from entering the blackscreen (any paths I have to navigate to before the actual backup or restor command, and then those two commands) if I had the following setup...

Domain name : turnip-24

Username: turnip
Password: #####

mysql database: turnip_phpbb2
database username: pickup
database pswd: ####

I hope I gave an exampe of all the possible variables..

PS (so people don't panic that I am entering my confidental stuff, this is all made up, but if you can use it in the example I can replace with my real passwords and stuff)
ojenni
Hi,

Please be aware, that you can really damage a lot using ssh if you do not know what you are doing. So why don't you use the backup feature that comes with the cpanel (http://www.yourdomain.com/cpanel)? This will be much safer for you.

You can also find tutorials to learn linux shell. Here is an example http://linux.org.mt/article/terminal

But again... if you don't really know what you are doing ssh access is the wrong tool for you, believe me.

Regards,
Oliver
artrocity
This is really not a shell question but a MYSQL Question.

http://dev.mysql.com/doc/mysql/en/mysql.html
http://dev.mysql.com/doc/mysql/en/mysqldump.html

backup:
MYSQLDUMP --add-drop-table -u pickup -psooper turnip_phpbb2 > backup.sql

restore:
MYSQL -u pickup -psooper turnip_phpbb2 < backup.sql
Vanya
backup:
mysqldump -u<DB user> -p<pass for it> DBname > dumpfile.sql

restore
mysql -u<DB user> -p<pass for it> DBName < dumpfile.sql
wendas
The reason I am trying to change is that right now my phpbb which is still in test with only empty forums & 2 users cannot backup & restore without spliting the database into 2 runs.. I forsee it being impossible to use when we have true data in it..

Also final straw was when I tried to restore from an sql I deleted out the tables & ran the script & not even one table would restore. Support had to take my script & manipulate it behind the scenes to get my data back.

Believe me SSH is not something I am going to get cozy with. It reminds me of the bad old days of DOS..

I want to learn these two commands & that is all I will be doing in this area.

Wenda
MartinB
you can run the follow script with a cron:

CODE
#!/bin/bash

mydate=`date +%Y-%m-%d`
dump_path="/home/youruser/backups"
db="yourdatabase"
user="user"
pass="password"
dump_file=$db".$mydate.sql.gz"
myemail="yourname@yourdomain.com"

mysqldump -u $user --password=$pass --opt $db | gzip -c > $dump_path/$dump_file

(echo "Database Backup for $mydate"; uuencode $dump_path/$dump_file $dump_file ) | mail -s "Database dump - $mydate" $myemail.


you will get your dump at your mail and in your backup directory

the --opt add an DROP TABLE IF EXISTS in the dump.
so for restore you only need to uncompress your dump and import it.
wendas
HMM.. Thanks so much for the help so far I feel confident I know what I want to type in now, but I Need one clue more..

I got into the ssh shell, logged in.. I got the following

display line

QUOTE
ssh-2.0-OpenSSH_3.6.lp2
                                      |  <-- point cursor stopped at.


But I can type all I want and the cursor just sits there empty, like the screen is hung and can not take my command.
phobos
To work with SSH you need to use some SSH client (not telnet).
I recommend you to choose Putty.
It is simple, configurable and free.

You can download it from following URL:
http://www.chiark.greenend.org.uk/~sgtatham/putty/

I also suggest you do not publish your login or password information by security
reasons.

I hope this information will help you.
micah
old thread I know... but I tried to implement the script mblendinger provided above and I'm getting the following error

QUOTE
line 13: 15633 Broken pipe            uuencode $dump_path/$dump_file $dump_file


from what i can tell, this means the reader is finishing before the writer. has anyone else run into this type of error and what has been the solution?
MartinB
the backup is created, but the problem is the mail feature of the script.

I try it now and i get a:

CODE
test: line 12: /bin/mail: Permission denied
test: line 12: 29427 Broken pipe             uuencode $dump_path/$dump_file $dump_file


maybe this is the problem.
micah
hmm, are there any other methods which can be used to mail the backup from the command line?
MartinB
Im sure than support will give you an answer for this.

If you submit a ticket, please come back later and post the info in this post for us smile.gif

greetings.
micah
Slavik Koshelev recommended i use the mail() function in PHP. now I'll have to figure out how to do this from shell script.
MartinB
you will need translate the script to php (.php)
you can execute php scripts from command line with no problems.

PHP on the Command Line
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.
IPS Driver Error

IPS Driver Error

There appears to be an error with the database.
You can try to refresh the page by clicking here