{"id":539,"date":"2008-10-10T00:00:00","date_gmt":"2008-10-09T16:00:00","guid":{"rendered":"http:\/\/www.strongd.net\/?p=539"},"modified":"2011-03-19T13:45:41","modified_gmt":"2011-03-19T05:45:41","slug":"%e5%88%a9%e7%94%a8samba%e5%a4%87%e4%bb%bd%e6%96%87%e4%bb%b6%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=539","title":{"rendered":"\u5229\u7528samba\u5907\u4efd\u6587\u4ef6\u3002"},"content":{"rendered":"<p><P>\u5229\u7528samba\u5907\u4efd\u6587\u4ef6\u3002<\/P><br \/>\n<P>\u9996\u5148\u5b89\u88c5samba <BR># yum install samba<\/P><br \/>\n<P>\u589e\u52a0\u7528\u6237backupuser<BR>#adduser backupuser -g users<BR>\u7136\u540e\u4fee\u6539backupuser\u7684\u5bc6\u7801xxxxxx<BR>#passwd backupuser<\/P><br \/>\n<P>[backupfile]<BR>&nbsp;&nbsp;&nbsp; comment = file backup dir.it will auto backup per hour.<BR>&nbsp;&nbsp;&nbsp; valid users= backupuser<BR>&nbsp;&nbsp;&nbsp; path=\/data\/backupfile<BR>&nbsp;&nbsp;&nbsp; browseable=no<BR>&nbsp;&nbsp;&nbsp; writable=yes<\/P><br \/>\n<P>\u589e\u52a0smbuser<BR>#smbpasswd -a backupuser<BR>\u8f93\u5165\u5bc6\u7801\uff0c\u76f4\u63a5\u6309\u56de\u8f66\u5c31\u53ef\u4ee5\u4e86\u3002<\/P><br \/>\n<P>#mount -t cifs -o username=strong,password=strongkiller -v \/\/mysqlhost\/1363file \/backupdir<\/P><br \/>\n<P>\u5982\u679c\u51fa\u73b0\u9519\uff0c\u5982\u6743\u9650\u7b49\uff0c\u8bf7\u786e\u8ba4backupuser\u6709\u8bfb\u5199\/data\/backupfile\u7684\u6743\u9650\uff0c\u5982\u679c\u8fd8\u4e0d\u884c\u5c31\u628aseLinux\u5173\u95ed\u3002<\/P><br \/>\n<P>#vi backup_file_per_hour.sh <\/P><br \/>\n<P>#!\/bin\/sh<BR>time_year_month=&#8221;$(date +&#8221;%Y%m&#8221;)&#8221;<BR>time_day=&#8221;$(date +&#8221;%d&#8221;)&#8221;<BR>need_backup_folder=&#8221;\/data2\/album\/$time_year_month\/$time_day&#8221;<BR>backup_year_folder=&#8221;\/backupdir\/album\/$time_year_month&#8221;<BR>if [ ! -d $backup_year_folder ]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mkdir $backup_year_folder<BR>fi<\/P><br \/>\n<P>backup_current_folder=&#8221;\/backupdir\/album\/$time_year_month\/$time_day&#8221;<BR>if [ ! -d $backup_current_folder ]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mkdir $backup_current_folder<BR>fi<\/P><br \/>\n<P>cp -rfu $need_backup_folder\/*.* $backup_current_folder\/<\/P><br \/>\n<P>#crontab -e<\/P><br \/>\n<P>59 * * * * sh \/home1\/software\/backup_file_per_hour.sh<BR><\/P><br \/>\n<DIV><\/DIV><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5229\u7528samba\u5907\u4efd\u6587\u4ef6\u3002 \u9996\u5148\u5b89\u88c5samba # yum install samba \u589e\u52a0\u7528\u6237backupuser#adduser backupuser -g users\u7136\u540e\u4fee\u6539backupuser\u7684\u5bc6\u7801xxxxxx#passwd backupuser [backupfile]&nbsp;&nbsp;&nbsp; comment = file backup dir.it will auto backup per hour.&nbsp;&nbsp;&nbsp; valid users= backupuser&nbsp;&nbsp;&nbsp; path=\/data\/backupfile&nbsp;&nbsp;&nbsp; browseable=no&nbsp;&nbsp;&nbsp; writable=yes \u589e\u52a0smbuser#smbpasswd -a backupuser\u8f93\u5165\u5bc6\u7801\uff0c\u76f4\u63a5\u6309\u56de\u8f66\u5c31\u53ef\u4ee5\u4e86\u3002 #mount -t cifs -o username=strong,password=strongkiller -v \/\/mysqlhost\/1363file \/backupdir \u5982\u679c\u51fa\u73b0\u9519\uff0c\u5982\u6743\u9650\u7b49\uff0c\u8bf7\u786e\u8ba4backupuser\u6709\u8bfb\u5199\/data\/backupfile\u7684\u6743\u9650\uff0c\u5982\u679c\u8fd8\u4e0d\u884c\u5c31\u628aseLinux\u5173\u95ed\u3002 #vi backup_file_per_hour.sh #!\/bin\/shtime_year_month=&#8221;$(date +&#8221;%Y%m&#8221;)&#8221;time_day=&#8221;$(date +&#8221;%d&#8221;)&#8221;need_backup_folder=&#8221;\/data2\/album\/$time_year_month\/$time_day&#8221;backup_year_folder=&#8221;\/backupdir\/album\/$time_year_month&#8221;if [ ! -d $backup_year_folder ]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mkdir $backup_year_folderfi backup_current_folder=&#8221;\/backupdir\/album\/$time_year_month\/$time_day&#8221;if [ &hellip; <a href=\"https:\/\/www.strongd.net\/?p=539\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u5229\u7528samba\u5907\u4efd\u6587\u4ef6\u3002<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-539","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=539"}],"version-history":[{"count":1,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/539\/revisions"}],"predecessor-version":[{"id":658,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/539\/revisions\/658"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}