![]() |
عمل Backup لـ sysconfig directory بـ easy bashscript
السلام عليكم ورحمة الله وبركاته
فى هذا الموضوع ساقوم بشرح خطوات تفصيليه لعمل نسخة احتياطيه لمجلد sysconfig على RHEL 5 server المصدر Backup script for the sysconfig directory STEP 1 Create file using vi editor backup-sysconfig.sh [root@server ~]#vi backup-sysconfig.sh step 2 Paste the following script #!/bin/bash # This script creates a backup of /etc/sysconfig # into a datestamped subdirectory of ~/backups/ cp -av /etc/sysconfig ~/backups/sysconfig-$(date '+%Y%m%d') echo "Backup of /etc/sysconfig completed at: $(date) step 3 Copy this file from home directory to the /bin step 4 create the backup directory on the root home directory [root@server ~]#mkdir backups step 5 Make this file executable by writing the following command [root@server ~]#chmod u+x ~/bin/backup-sysconfig.sh step 6 You are now ready to try out your script. You should see something like the following: [root@server ~]# backup-sysconfig.sh `/etc/sysconfig' -> `/root/backups/sysconfig-20100102' `/etc/sysconfig/pand' -> `/root/backups/sysconfig-20100102/pand' `/etc/sysconfig/ipmi' -> `/root/backups/sysconfig-20100102/ipmi' `/etc/sysconfig/rhn' -> `/root/backups/sysconfig-20100102/rhn' `/etc/sysconfig/rhn/up2date' -> `/root/backups/sysconfig-20100102/rhn/up2date' `/etc/sysconfig/rhn/clientCaps.d' -> `/root/backups/sysconfig-20100102/rhn/clientCaps.d' `/etc/sysconfig/rhn/rhnsd' -> `/root/backups/sysconfig-20100102/rhn/rhnsd' `/etc/sysconfig/kudzu' -> `/root/backups/sysconfig-20100102/kudzu' `/etc/sysconfig/dund' -> `/root/backups/sysconfig-20100102/dund' step 7 Now check the backup directory [root@server ~]# cd backups/ [root@server backups]# ls sysconfig-20100102 [root@server backups]# cd sysconfig-20100102/ [root@server sysconfig-20100102]# ls apmd crond ip6tables-config modules sendmail apm-scripts desktop ipmi network smartmontools auditd dund iptables networking spamassassin authconfig firstboot iptables-config network-scripts squid autofs grub irda ntpd syslog bluetooth hidd irqbalance pand system-config-securitylevel cbq httpd kdump prelink system-config-users clock hwconf kernel readonly-root tux conman i18n keyboard rhn vncservers console init kudzu saslauthd wpa_supplicant cpuspeed ip6tables mkinitrd selinux |
بارك الله فيك اخي الكريم ،
بس ممكن تسرد لنا فائده هذا ؟ |
جميع الأوقات بتوقيت مكة المكرمة. الساعة الآن » 08:29 AM. |
Powered by vBulletin
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © ArabWebTalk.Com 2004-2012