cp file always getting overwrite prompt?
wondering why always getting overwrite prompt when use “cp” command with “-f” option
try this,
1. login as root
1 | vi /root/.bashrc |
2. comment out this line
1 | #alias cp='cp -i' |
3. logout and login again
wondering why always getting overwrite prompt when use “cp” command with “-f” option
try this,
1. login as root
1 | vi /root/.bashrc |
2. comment out this line
1 | #alias cp='cp -i' |
3. logout and login again
rsync can synchronizes files and directories from one server to another. It’s perfectly for backup or create a mirror site purpose.
This tutorial shows you step by step to create a rsync server and client server.
First of all, you must have rsync installed. For fedora, rsync should be included by default. If you don’t have it, run
1 | yum install rsync |
Setup rsync server
Create rsync configuration file:
1 2 3 4 5 6 7 | cd /etc mkdir rsyncd cd rsyncd touch rsyncd.conf touch rsyncd.motd touch rsyncd.user chmod 600 rsyncd.user |
edit rsyncd.user file:
vi /etc/rsyncd.user
1 | my_rsync_user_1:user_1_password |
edit rsyncd.conf file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | pid file=/var/run/rsyncd.pid port=873 uid=root gid=root use chroot=yes read only=yes # limit access to LANS hosts allow=192.168.2.0/255.255.255.0 #default, listen to lan server host deny=* max connections=5 motd file=/etc/rsyncd/rsyncd.motd log format=%t%a%m%f%b syslog facility=local3 timeout=300 [profile_1] #profile name path = /path/to/backup/directory ignore errors read only = false list = false hosts allow = 66.66.66.66 #listen to client server which use public ip hosts deny = 0.0.0.0/32 auth users = my_rsync_user_1 secrets file = /etc/rsyncd/rsyncd.user #[profile_1] #another profile name #path = /path/to/backup/directory/2 #ignore errors #read only = false #list = false #hosts allow = 88.88.88.88 #listen to client server which use public ip #hosts deny = 0.0.0.0/32 #auth users = my_rsync_user_2 #secrets file = /etc/rsyncd/rsyncd.user |
Next, create init start up script
vi /etc/init.d/rsyncd
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #!/bin/sh # # Startup script for rsyncd daemon # # chkconfig: 35 90 10 # description: Server data for sync to other server # processname rsync # Source function library . /etc/rc.d/init.d/functions prog=rsync conf=/etc/rsyncd/rsyncd.conf case "$1" in start) echo -n "Starting rsync daemon: " daemon /usr/bin/$prog --daemon --config=$conf RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/$prog ;; stop) echo -n "Shutting down $prog: " killproc -d 60 $prog RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog ;; status) status $prog ;; restart) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0 |
make /etc/init.d/rsyncd executable, and register this service
3 4 5 | chmod +x /etc/init.d/rsyncd /sbin/chkconfig --add rsyncd /sbin/service rsyncd start |
Setup rsync client
first, of course you must have rsync installed on client server
make rsync password file
1 2 3 4 5 | cd /etc mkdir rsync cd rsync touch rsync.pwd chmod 600 rsync.pwd |
vi /etc/rsync/rsync.pwd
1 | user_1_password |
execute this command to start synchronize file to server
1 | rsync -vrtLogp --progress /path/to/directory/to/be/backup/* my_rsync_user_1@[SERVER_IP]::profile_1 --password-file=/etc/rsync/rsync.pwd |
where [SERVER_IP] is rsync server IP
1 2 3 4 5 6 7 | #include <iostream> int main() { std::cout << "Hello world, compiled with g++ on linux" << std::endl; return 0; } |
compile this and move to your secured tmp partition and execute it. If you get a permission error, tmp partition is mounted correctly with noexec.
ncftpget is able to let you download entire ftp directory and sub directories from remote ftp server.
Install ncftp client
1 | yum install ncftp |
Start downloading
1 | ncftpget -R -v -u "username" -p "userpassword" ftp.someserver.com /home/save_at_here /downloads |
where,
Recently I use mysql-zrm to backup a large databases from a client server. I can backup all databases or a set of database or maybe some of tables with one line linux command. Pretty easy to use.
You may imagine that mysql-zrm is a strong management tool of mysql, mysqldump and mysqlhotcopy. The key benifits for me are : I can backup all databases at once with my databases are automatically created if a new client comes; mysql-zrm is able to save compressed data to different folder, so I can keep saved data up to seven days (you may do it one month or maybe one year); It also has a scheduler to do your task every certain time you want.
Installation:
1. login to your backup server
2. Download rpm from http://www.zmanda.com/download-zrm.php
3. If you don’t have Perl installed, run ” yum install perl ”
4. run ” rpm -ivh MySQL-zrm-2.0-1.noarch.rpm ”
5. “ vi /etc/mysql-zrm/mysql-zrm.conf ” update following parameters in file
backup-mode=logical [ ideally raw for myisam engine and logical for innodb. but I recommend using logical for default. Because when I use raw for default value, and if there is table with innodb engine exist, zrm will prompt me password for mysql@(server_ip) which have no idea about linux mysql user login ]
destination=/home/mybackup_dir [ specify where backup files will be stored]
Start backup:
mysql-zrm –action backup –host xxx.xxx.xxx.xxx –user aabb –password ccdd –backup-set abcd
where
–host is remote server IP for MySQL
–user is remote MySQL server user login
–password is remote MySQL server user login password
–backup-set is backup folder name
Result:
after running the command, you will get backup file in the path look like this
/home/mybackup_dir/abcd/20081128195236
Restore database to local server:
/usr/bin/mysql-zrm-restore –user=1122 –password=2233 –source-directory=/home/mybackup_dir/abcd/20081128195236
check out your backup server MySQL database.
First of all, this post is nowhere near a complete reference for linux memory usage and troubleshooting high memory usage. It only has the steps I’d taken to troubleshoot my own server when it gets overloaded by increased traffic. It happens once a while, and usually I can fix it by tuning some Apache, MySQL and other config setting.
1. using top command
After executing top command, press “Shift” + “>” and look at “RES” column. The RES column is the most reliable indicator of the real memory usage of that process.
2. ps axu –sort:rss
show memory usage sorted by lowest memory usages first.
A general Apache which serves static html page should consume less than 10MB per process.
For heavily serving PHP pages, in my case it uses 18MB-39MB each httpd process.
mysqld has a memory usage of 120MB in my case. I can tell that the query cache settings worked as planned.
ps aux –sort -vsz | head -25
Top memory hogs
uname -a
cat /proc/version
cat /etc/redhat-release
php -v
mysql -V
httpd -v
I just read this one from SWsoft forum.
There is a SQL injection vulnerable security hole exists on Plesk 8.x.x. Yes, it’s even on 8.2.0, which is the latest stable version.
It’s /usr/local/psa/admin/plib/class.Session.php.
Here’s the fix.