您现在的位置是:Linux - 技术吧
  • Linux服务器find指定文件后保留原路径复制

    #!/bin/bash
    cd /datafile
    
    for i in `find . -name 'composer.json' `
      do 
      pth=/datafile/bak/`dirname $i`
      mkdir -p $pth
      cp $i $pth
      #rm  $i
      echo $i
    done

    yuli0927 2019年10月08日 标签: Shell Linux分类: Linux

  • CentOS安装和配置rsync

    1、配置服务端

    yum install rsync
    vi /root/rsync_user // 设置密码文件
    chmod 600 /root/rsync_user // 设置密码文件权限 
    vi /etc/rsyncd.conf // 配置服务
    vi /etc/xinetd.d/rsync // 配置服务
    chkconfig rsync on // 设置开机启动
    /usr/bin/rsync --daemon 启动服务
    ps -ef | grep rsync // 检查是否启动

    密码root_user文件内容

    test:123456
    配置文件rsyncd.conf内容
    uid = nobody
    gid = nobody
    use chroot = yes
    pid file = /var/run/rsyncd.pid
    log file = /var/run/rsyncd.log
    
    [www]
    uid = root
    gid = root
    comment = www
    path = /data/wwwroot
    auth users = test
    secrets file = /root/rsync_user
    read only = yes

    配置文件/etc/xinetd.d/rsync内容

    主要修改内容:
    disable = no
    server_args     = --config=/etc/rsyncd.conf --daemon

    # default: off
    # description: The rsync server is a good addition to an ftp server, as it \
    #       allows crc checksumming etc.
    service rsync
    {
            disable = no
            flags           = IPv6
            socket_type     = stream
            wait            = no
            user            = root
            server          = /usr/bin/rsync
            server_args     = --config=/etc/rsyncd.conf --daemon
            log_on_failure  += USERID
    }
    


    2、配置客户端

    yum install rsync
    vi /root/rsync_pass

    文件/root/rsync_pass内容

    123456


    3、在客户端测试服务

    rsync -az  test@192.168.100.2::www // 需要输入密码
    rsync -vzrtopy --progress --delete  test@192.168.100.2::www --password-file=/root/rsync_pass /www
    

    4、写shell脚本、设置定时任务

    */3 * * * * /usr/local/src/test.sh &
    test.sh文件内容


    #!/bin/bash
    cd /www
    rsync -vzrtopy --progress --delete  test@192.168.100.2::www--password-file=/root/rsync_pass /www &>/dev/null
    


    yuli0927 2018年09月11日 标签: 备份 Linux CentOS rsync分类: Linux

  • iptables: No config file.

    iptables -P OUTPUT ACCEPT
    service iptables save
    service iptables start
    

    yuli0927 2018年09月11日 标签: Linux iptables分类: Linux

  • win7和CentOS双系统设置默认启动

    默认启动系统default=0

    选择停留时间timeout=3

    vi /boot/grub/grub.conf
    
    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE:  You do not have a /boot partition.  This means that
    #          all kernel and initrd paths are relative to /, eg.
    #          root (hd0,7)
    #          kernel /boot/vmlinuz-version ro root=/dev/sda8
    #          initrd /boot/initrd-[generic-]version.img
    #boot=/dev/sda
    default=0
    timeout=3
    splashimage=(hd0,7)/boot/grub/splash.xpm.gz
    hiddenmenu
    title CentOS 6 (2.6.32-754.el6.x86_64)
    	root (hd0,7)
    	kernel /boot/vmlinuz-2.6.32-754.el6.x86_64 ro root=UUID=4511068a-612d-402c-9472-55dbab5a9d49 nomodeset rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_MD crashkernel=128M LANG=zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet
    	initrd /boot/initramfs-2.6.32-754.el6.x86_64.img
    title Windows 7
    	rootnoverify (hd0,0)
    	chainloader +1
    

    yuli0927 2018年09月10日 标签: Linux CentOS分类: Linux

  • Centos设置桌面或命令行启动

    3命令行启动

    5图形界面启动

    vi /etc/inittab 
    
    # Default runlevel. The runlevels used are:
    #   0 - halt (Do NOT set initdefault to this)
    #   1 - Single user mode
    #   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
    #   3 - Full multiuser mode
    #   4 - unused
    #   5 - X11
    #   6 - reboot (Do NOT set initdefault to this)
    # 
    id:5:initdefault:
    

    yuli0927 2018年09月10日 标签: Linux CentOS分类: Linux

1 2 3 4 5 6 ... Next »... Last »