{"id":160,"date":"2023-10-18T19:06:00","date_gmt":"2023-10-18T17:06:00","guid":{"rendered":"https:\/\/blubb.fish\/?p=160"},"modified":"2023-10-18T10:11:01","modified_gmt":"2023-10-18T08:11:01","slug":"run-bash-script-on-monday-of-month","status":"publish","type":"post","link":"https:\/\/blubb.fish\/index.php\/2023\/10\/18\/run-bash-script-on-monday-of-month\/","title":{"rendered":"Run Bash script on Monday of month"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Sometimes there are needs to run a bash script on the first monday of every month.<br>This can be easily achieved.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create crontab entry to run script every monday:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>00 09 * * mon \/script.sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">now in the script add the check for the first monday of month:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\n# get date in correct format\nnumber=$(date +\"%u%d\")\n# make an if to only run on first monday\nif &#91; ${number} -le 107 ] ; then\n\n# add some code here\n\nfi<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes there are needs to run a bash script on the first monday of every month.This can be easily achieved. Create crontab entry to run script every monday: now in the script add the check for the first monday of month:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,3],"tags":[],"class_list":["post-160","post","type-post","status-publish","format-standard","hentry","category-allgemein","category-linux"],"_links":{"self":[{"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/posts\/160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/comments?post=160"}],"version-history":[{"count":1,"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/posts\/160\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/posts\/160\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/media?parent=160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/categories?post=160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blubb.fish\/index.php\/wp-json\/wp\/v2\/tags?post=160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}