<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>onsanai</author_name>
  <author_url>https://blog.hatena.ne.jp/onsanai/</author_url>
  <blog_title>物理の駅 Physics station by 現役研究者</blog_title>
  <blog_url>https://phst.hateblo.jp/</blog_url>
  <categories>
    <anon>Linux/Ubuntu</anon>
    <anon>リモート管理</anon>
  </categories>
  <description>CRON で実行したときだけプログラムが想定どおりに動かないと思ったら、PATH等の環境変数の設定が読み込まれていなかった。 crontab -e 等で 毎分実行させるシェルスクリプトを指定する場合は * * * * * /home/physics/bin/test.sh &gt; /dev/null 2&gt;&amp;1 などと設定るすが、CRONで test.sh 実行時は、通常bash起動時に実行される ~/.bashrc や、ログオン時に実行される ~/.bash_profile は読み込まれない。 なので、必要に応じて、必要な設定をシェルスクリプト内で読み込むようにしよう。 source /home/…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fphst.hateblo.jp%2Fentry%2F2024%2F10%2F21%2F080000&quot; title=&quot;CRONでは .bashrc 等で設定した環境変数は読み込まれない - 物理の駅 Physics station by 現役研究者&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-10-21 08:00:00</published>
  <title>CRONでは .bashrc 等で設定した環境変数は読み込まれない</title>
  <type>rich</type>
  <url>https://phst.hateblo.jp/entry/2024/10/21/080000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
