{"id":65718,"date":"2021-07-12T04:10:04","date_gmt":"2021-07-12T08:10:04","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/on-thursday-and-friday-tar-all-contents-of-etc-folder-into-export-home-shell-test-etc-tar-do-misc-logs-linux-unix-shell-programming-001\/"},"modified":"2021-07-12T04:10:04","modified_gmt":"2021-07-12T08:10:04","slug":"on-thursday-and-friday-tar-all-contents-of-etc-folder-into-export-home-shell-test-etc-tar-do-misc-logs-linux-unix-shell-programming-001","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=65718","title":{"rendered":"On Thursday and Friday tar all contents of \/etc folder into \/export\/home\/shell\/test\/etc.tar .. do misc logs #Linux\/Unix: Shell Programming &#8211; 001"},"content":{"rendered":"<p>#!\/bin\/ksh<\/p>\n<p># on every thursday and friday tar all contents of \/etc folder into \/export\/home\/shell\/test\/. On thursday only create a log file with the list of files<br \/>\n#in the tar file. On thursday untar \/export\/home\/shell\/test\/etc.tar into vfstab . Then log vfstab exist or not information<\/p>\n<p>DAY=`date +%a`<br \/>\nDATESTAMP=`date +%m-%d-%Y-%H:%M`<\/p>\n<p>if [[ &#8220;$DAY&#8221; == Mon ]]<br \/>\nthen<\/p>\n<p>echo &#8220;Today is Monday&#8221;<\/p>\n<p>elif [[ &#8220;$DAY&#8221; == Tue ]]<br \/>\nthen<\/p>\n<p>echo &#8220;Today is Tuesday&#8221;<\/p>\n<p>elif [[ &#8220;$DAY&#8221; == Wed ]]<br \/>\nthen<\/p>\n<p>echo &#8220;Today is Wednesday&#8221;<\/p>\n<p>elif [[ &#8220;$DAY&#8221; == Thu ]]<br \/>\nthen<\/p>\n<p>echo &#8220;Today is Thursday&#8221; &gt;&gt; \/export\/home\/shell\/test\/log\/backup-$DATESTAMP.log<br \/>\ncd \/etc<br \/>\ntar cvf \/export\/home\/shell\/test\/etc.tar * &gt;&gt; \/export\/home\/shell\/test\/log\/backup-$DATESTAMP.log<br \/>\ncd \/export\/home\/shell\/test<br \/>\ntar xvf etc.tar vfstab<\/p>\n<p>if [[ -f vfstab ]]<br \/>\nthen<br \/>\necho &#8220;file vfstab exist&#8221; &gt;&gt; \/export\/home\/shell\/test\/log\/backup-$DATESTAMP.log<br \/>\nelse<br \/>\necho &#8220;file vfstab does not exist&#8221; &gt;&gt; \/export\/home\/shell\/test\/log\/backup-$DATESTAMP.log<br \/>\nfi<\/p>\n<p>elif [[ &#8220;$DAY&#8221; == Fri ]]<br \/>\nthen<\/p>\n<p>echo &#8220;Today is Friday&#8221;<br \/>\ncd \/etc<br \/>\ntar cvf \/export\/home\/shell\/test\/etc.tar *<\/p>\n<p>elif [[ &#8220;$DAY&#8221; == Sat ]]<br \/>\nthen<br \/>\necho &#8220;Today is Saturday&#8221;<\/p>\n<p>else<br \/>\necho &#8220;Today is Sunday&#8221;<\/p>\n<p>fi<\/p>\n<p>exit From: http:\/\/sitestree.com\/?p=12199<br \/> Categories:Linux\/Unix: Shell Programming &#8211; 001<br \/>Tags:<br \/> Post Data:2018-04-16 19:44:31<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/ksh # on every thursday and friday tar all contents of \/etc folder into \/export\/home\/shell\/test\/. On thursday only create a log file with the list of files #in the tar file. On thursday untar \/export\/home\/shell\/test\/etc.tar into vfstab . Then log vfstab exist or not information DAY=`date +%a` DATESTAMP=`date +%m-%d-%Y-%H:%M` if [[ &#8220;$DAY&#8221; == Mon ]] &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=65718\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-65718","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":14171,"url":"http:\/\/bangla.sitestree.com\/?p=14171","url_meta":{"origin":65718,"position":0},"title":"\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0 \u098f\u09ac\u0982 \u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0\u09c7 \/ etc \u09ab\u09cb\u09b2\u09cd\u09a1\u09be\u09b0\u09c7 \u09b8\u09ae\u09b8\u09cd\u09a4 \u09ac\u09bf\u09b7\u09af\u09bc\u09ac\u09b8\u09cd\u09a4\u09c1 \/export\/home\/shell\/test\/etc.tar \u09a4\u09c7  tar \u09b9\u09bf\u09b8\u09be\u09ac\u09c7 backup \u0995\u09b0\u09c1\u09a8","author":"Sayed","date":"April 16, 2018","format":false,"excerpt":"#!\/bin\/ksh # on every thursday and friday tar all contents of \/etc folder into \/export\/home\/shell\/test\/. On thursday only create a log file with the list of files #in the tar file. On thursday untar \/export\/home\/shell\/test\/etc.tar into vfstab . Then log vfstab exist or not information DAY=`date +%a` DATESTAMP=`date +%m-%d-%Y-%H:%M` if\u2026","rel":"","context":"In &quot;\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming&quot;","block_context":{"text":"\u09b6\u09c7\u09b2 \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae\u09bf\u0982 - Shell Programming","link":"http:\/\/bangla.sitestree.com\/?cat=1888"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65720,"url":"http:\/\/bangla.sitestree.com\/?p=65720","url_meta":{"origin":65718,"position":1},"title":"If then else example in Shell Programming #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 12, 2021","format":false,"excerpt":"#!\/bin\/sh #If then else example #if elif else NOF=5 if [ $NOF -eq 27 ] then echo \"No of files and directories = 27\" elif [ $NOF -gt 27 ] then echo \"No of files are dir are greator than 27\" else echo \"No of files and directories are less\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14027,"url":"http:\/\/bangla.sitestree.com\/?p=14027","url_meta":{"origin":65718,"position":2},"title":"SSH\/SSHD\/OpenSSH in CentOS\/Redhat Linux","author":"Sayed","date":"December 24, 2017","format":false,"excerpt":"Experiment with SSH\/SSHD\/OpenSSH in CentOS\/Redhat Linux Yes, from\u00a0 my history (Probably a review for the technical people, who already knew these sometimes in the past) 461 echo \"dec 24th, 2017\" 462 vim \/etc\/ssh\/sshd_config 463 echo \"SSH Related Commands\" 464 scp -> secure copy 465 tscp -> secure copy for windows\u2026","rel":"","context":"In &quot;\u09b2\u09bf\u09a8\u09be\u0995\u09cd\u09b8 \u098f\u09ac\u0982 \u0989\u09a8\u09bf\u0995\u09cd\u09b8 \u0964 Linux and Unix&quot;","block_context":{"text":"\u09b2\u09bf\u09a8\u09be\u0995\u09cd\u09b8 \u098f\u09ac\u0982 \u0989\u09a8\u09bf\u0995\u09cd\u09b8 \u0964 Linux and Unix","link":"http:\/\/bangla.sitestree.com\/?cat=1231"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65693,"url":"http:\/\/bangla.sitestree.com\/?p=65693","url_meta":{"origin":65718,"position":3},"title":"Example use of case in KSH. Show Today&#8217;s Day Name #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 11, 2021","format":false,"excerpt":"bash-3.2$ cat ksh_case_example_1.sh #!\/bin\/ksh #show today's day name DAY=`date +%a` #show value of $DAY echo $DAY #based on the value of the DAY variable show the day name in full format case \"$DAY\" in Mon) echo \"Monday\" ;; Tue) echo \"Tuesday\" ;; Wed) echo \"Wednesday\" ;; Thu) echo \"Thursday\" ;;\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65722,"url":"http:\/\/bangla.sitestree.com\/?p=65722","url_meta":{"origin":65718,"position":4},"title":"Topic 1: Basic Date Displaying Shell Script #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 12, 2021","format":false,"excerpt":"bash-3.2$ cat echoscript1.sh #!\/bin\/sh #clear echo \"SCRIPT BEGINS\" echo \"Hello $LOGNAME\" echo echo \"Todays date is: c\" date '+%m\/%d\/%y' echo \"and the current time is: c\" date '+%H:%M:%S%n' echo \"Now a list of the processes in the current shell\" ps echo \"SCRIPT FINISHED!!\" bash-3.2$ .\/echoscript1.sh SCRIPT BEGINS Hello shell Todays\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65685,"url":"http:\/\/bangla.sitestree.com\/?p=65685","url_meta":{"origin":65718,"position":5},"title":"A Basic Shell Program #Linux\/Unix: Shell Programming &#8211; 001","author":"Author-Check- Article-or-Video","date":"July 11, 2021","format":false,"excerpt":"#!\/bin\/sh #if enabled - will spit out the script to the screen #set -v #clear the screen clear echo \"SCRIPT BEGINS\" #shows current login name echo \"Hello $LOGNAME\" #shows current date in the same line echo \"Todays date is: c\" date +%m\/%d\/%y #shows current time in the same line echo\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=65718"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/65718\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=65718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=65718"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=65718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}