{"id":69,"date":"2012-02-15T15:15:24","date_gmt":"2012-02-15T15:15:24","guid":{"rendered":"http:\/\/devopsny.com\/blog\/?p=69"},"modified":"2013-08-30T19:00:22","modified_gmt":"2013-08-30T23:00:22","slug":"deployment-script-wip","status":"publish","type":"post","link":"https:\/\/devopsny.com\/blog\/2012\/02\/15\/deployment-script-wip\/","title":{"rendered":"Deployment Script WIP"},"content":{"rendered":"<p>This is a work in progress&#8230;<\/p>\n<div>#!\/bin\/sh<\/div>\n<div>SOURCEPATH=&#8217;\/var\/git\/working_copies\/website\/webroot\/&#8217;<br \/>\nDESTPATH=&#8217;\/var\/www\/website\/webroot&#8217;<br \/>\nDESTUSER=&#8217;deploy&#8217;<br \/>\nLOGFILE=&#8217;\/var\/log\/website_rsync.log&#8217;<br \/>\nSUBJECT=&#8221;website.com \u00a0Prod Updated:from MANAGE01SRV&#8221;<br \/>\nEMAIL=&#8221;me<a href=\"mailto:weboperations@nbty.com\">@me.com<\/a>&#8221;<br \/>\nEMAILCC=&#8221;me<a href=\"mailto:craigcarnell@nbty.com\">@me.com<\/a>&#8220;<\/div>\n<div>echo &#8220;Job started at: `\/bin\/date`&#8221; &gt; $LOGFILE<\/div>\n<div>for SERVER in web01 web02 web03 web04<br \/>\nif $SERVER = &#8220;web01&#8221; then NSSRV = &#8220;wb01&#8221;<br \/>\nelse NSSRV = &#8220;wb02&#8221;<br \/>\ndo<br \/>\nssh <a href=\"mailto:nsroot@10.209.0.11\">nsroot@<\/a>netscaler\u00a0&#8216;disable server site01_$NSSRV&#8217;<br \/>\nssh <a href=\"mailto:$DESTUSER@$SERVER\">$DESTUSER@$SERVER<\/a> service apache2 stop &gt;&gt; $LOGFILE<br \/>\nrsync -avc &#8211;delete &#8211;exclude=&#8221;.git&#8221; &#8211;exclude=&#8221;var\/&#8221; &#8211;exclude=&#8221;.gitignore&#8221; &#8211;rsh=ssh $SOURCEPATH <a href=\"mailto:$DESTUSER@$SERVER:$DESTPATH\">$DESTUSER@$SERVER:$DESTPATH<\/a> 2&gt;&amp;1 &gt;&gt; $LOGFILE<br \/>\nssh <a href=\"mailto:$DESTUSER@$SERVER\">$DESTUSER@$SERVER<\/a> rm -rf $DESTPATH\/var\/cache\/*<br \/>\nssh <a href=\"mailto:$DESTUSER@$SERVER\">$DESTUSER@$SERVER<\/a> \/var\/scripts\/fixperms.sh &gt;&gt; $LOGFILE<br \/>\nssh <a href=\"mailto:$DESTUSER@$SERVER\">$DESTUSER@$SERVER<\/a> service apache2 start &gt;&gt; $LOGFILE<br \/>\nssh <a href=\"mailto:nsroot@10.209.0.11\">nsroot@<\/a>netscaler\u00a0&#8216;enable server site01_$NSSRV&#8217;<br \/>\ndone<\/div>\n<div>echo &#8220;Job completed at: `\/bin\/date`&#8221; &gt;&gt; $LOGFILE<\/div>\n<div>\/usr\/bin\/mail -s &#8220;$SUBJECT&#8221; &#8220;$EMAIL&#8221; &lt; $LOGFILE<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This is a work in progress&#8230; #!\/bin\/sh SOURCEPATH=&#8217;\/var\/git\/working_copies\/website\/webroot\/&#8217; DESTPATH=&#8217;\/var\/www\/website\/webroot&#8217; DESTUSER=&#8217;deploy&#8217; LOGFILE=&#8217;\/var\/log\/website_rsync.log&#8217; SUBJECT=&#8221;website.com \u00a0Prod Updated:from MANAGE01SRV&#8221; EMAIL=&#8221;me@me.com&#8221; EMAILCC=&#8221;me@me.com&#8220; echo &#8220;Job started at: `\/bin\/date`&#8221; &gt; $LOGFILE for SERVER in web01 web02 web03 web04 if $SERVER = &#8220;web01&#8221; then NSSRV = &#8220;wb01&#8221; else NSSRV = &#8220;wb02&#8221; do ssh nsroot@netscaler\u00a0&#8216;disable server site01_$NSSRV&#8217; ssh $DESTUSER@$SERVER service apache2 stop &gt;&gt; $LOGFILE [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[26,39,16,3,58],"tags":[27,42,21,59],"class_list":["post-69","post","type-post","status-publish","format-standard","hentry","category-apache2","category-bash","category-linux","category-load-balancing","category-netscaler","tag-apache2-2","tag-bash-2","tag-linux-2","tag-netscaler-2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3fcrv-17","jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/comments?post=69"}],"version-history":[{"count":9,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"predecessor-version":[{"id":314,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/posts\/69\/revisions\/314"}],"wp:attachment":[{"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devopsny.com\/blog\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}