{"id":2182,"date":"2026-02-25T10:35:11","date_gmt":"2026-02-25T01:35:11","guid":{"rendered":"https:\/\/kaizawa.jp\/?p=2182"},"modified":"2026-02-25T10:35:13","modified_gmt":"2026-02-25T01:35:13","slug":"ubuntu-server%e3%81%a7%e3%83%95%e3%82%a9%e3%83%ab%e3%83%80%e5%86%85%e3%81%ab%e3%83%95%e3%82%a9%e3%83%ab%e3%83%80%e3%81%8c%e3%81%82%e3%82%8b%e9%9a%8e%e5%b1%a4%e6%a7%8b%e9%80%a0%e3%81%ab%e3%81%aa","status":"publish","type":"post","link":"https:\/\/kaizawa.jp\/?p=2182","title":{"rendered":"ubuntu server\u3067\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u30d5\u30a9\u30eb\u30c0\u304c\u3042\u308b\u968e\u5c64\u69cb\u9020\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u4e2d\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u30e9\u30f3\u30c0\u30e0\u306b\u62bd\u51fa\u3057\u305f\u3044\u3002\u30b5\u30f3\u30d7\u30eb\u3092\u63d0\u793a\u3057\u3066\u307b\u3057\u3044\u3002\u306a\u304a\u3001\u62bd\u51fa\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u306b\u5bfe\u3057\u3066\u5225\u9014\u4f5c\u3063\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3059\u4e88\u5b9a\u3002"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">ubuntu server\uff08Linux\uff09\u3067\u3001\u7279\u5b9a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306b\u3042\u308b\u5b50\u30d5\u30a9\u30eb\u30c0\u3092\u30e9\u30f3\u30c0\u30e0\u306b\u62bd\u51fa\u3059\u308b\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f8c\u7d9a\u306e\u81ea\u4f5c\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u30d1\u30b9\u3092\u6e21\u3057\u3084\u3059\u3044\u3088\u3046\u3001\u30b7\u30f3\u30d7\u30eb\u3067\u5805\u7262\u306a\u624b\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1.&nbsp;<code>shuf<\/code>&nbsp;\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3046\uff08\u6700\u3082\u6a19\u6e96\u7684\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu\u306b\u306f\u6a19\u6e96\u3067&nbsp;<code>shuf<\/code>&nbsp;\u3068\u3044\u3046\u884c\u3092\u30b7\u30e3\u30c3\u30d5\u30eb\u3059\u308b\u30b3\u30de\u30f3\u30c9\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u3068&nbsp;<code>find<\/code>&nbsp;\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u306e\u304c\u6700\u3082\u7c21\u5358\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1\u3064\u3060\u3051\u30e9\u30f3\u30c0\u30e0\u306b\u62bd\u51fa\u3057\u3066\u30d1\u30b9\u3092\u8868\u793a\u3059\u308b\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>find \/path\/to\/target_dir -mindepth 1 -maxdepth 1 -type d | shuf -n 1\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-mindepth 1 -maxdepth 1<\/code>: \u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u306e\u300c\u76f4\u4e0b\u300d\u306b\u3042\u308b\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3092\u5bfe\u8c61\u306b\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><code>-type d<\/code>: \u30c7\u30a3\u30ec\u30af\u30c8\u30ea\uff08\u30d5\u30a9\u30eb\u30c0\uff09\u306e\u307f\u3092\u62bd\u51fa\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><code>shuf -n 1<\/code>: \u30b7\u30e3\u30c3\u30d5\u30eb\u3057\u3066\u4e0a\u304b\u30891\u884c\u3060\u3051\u53d6\u308a\u51fa\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">2. \u5909\u6570\u306b\u683c\u7d0d\u3057\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u300c\u62bd\u51fa\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u306b\u5bfe\u3057\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u52d5\u304b\u3059\u300d\u3068\u3044\u3046\u7528\u9014\u3067\u3042\u308c\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30ef\u30f3\u30e9\u30a4\u30ca\u30fc\u3084\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u5b9f\u7528\u7684\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u30ef\u30f3\u30e9\u30a4\u30ca\u30fc\u306e\u4f8b\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># \u30e9\u30f3\u30c0\u30e0\u306b\u9078\u3070\u308c\u305f1\u3064\u306e\u30d5\u30a9\u30eb\u30c0\u30d1\u30b9\u3092\u5909\u6570 target \u306b\u5165\u308c\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c<\/em>\ntarget=$(find \/path\/to\/target_dir -mindepth 1 -maxdepth 1 -type d | shuf -n 1) &amp;&amp; .\/your_script.sh \"$target\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u8907\u6570\uff08\u4f8b: 3\u3064\uff09\u9078\u3093\u3067\u9023\u7d9a\u3067\u51e6\u7406\u3059\u308b\u5834\u5408\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>find \/path\/to\/target_dir -mindepth 1 -maxdepth 1 -type d | shuf -n 3 | while read dir; do\n    echo \"Processing: $dir\"\n    .\/your_script.sh \"$dir\"\ndone\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">3. \u6ce8\u610f\u70b9\uff1a\u30d5\u30a9\u30eb\u30c0\u540d\u306b\u30b9\u30da\u30fc\u30b9\u304c\u3042\u308b\u5834\u5408<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u30d5\u30a9\u30eb\u30c0\u540d\u306b\u30b9\u30da\u30fc\u30b9\u3084\u7279\u6b8a\u6587\u5b57\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408\u306f\u3001<code>-print0<\/code>&nbsp;\u3068&nbsp;<code>shuf -z<\/code>&nbsp;\u3092\u4f7f\u3046\u3068\u5b89\u5168\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># \u30cc\u30eb\u6587\u5b57\u533a\u5207\u308a\u3067\u51e6\u7406\uff08\u6700\u3082\u5b89\u5168\u306a\u65b9\u6cd5\uff09<\/em>\ntarget=$(find \/path\/to\/target_dir -mindepth 1 -maxdepth 1 -type d -print0 | shuf -z -n 1 | tr -d '\\0')\n.\/your_script.sh \"$target\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5fdc\u7528\uff1a\u3082\u3063\u3068\u6df1\u304f\uff08\u968e\u5c64\u3092\u554f\u308f\u305a\uff09\u63a2\u3057\u305f\u3044\u5834\u5408<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u3082\u3057\u76f4\u4e0b\u3060\u3051\u3067\u306a\u304f\u3001\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u306e\u3055\u3089\u306b\u4e2d\u306b\u3042\u308b\u30d5\u30a9\u30eb\u30c0\u3082\u30e9\u30f3\u30c0\u30e0\u306b\u62bd\u51fa\u3057\u305f\u3044\u5834\u5408\u306f\u3001<code>-maxdepth 1<\/code>&nbsp;\u3092\u5916\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>find \/path\/to\/target_dir -type d | shuf -n 1\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305a\u306f\u3001<strong>\u300c\u5bfe\u8c61\u306e\u30d5\u30a9\u30eb\u30c0\u304c\u4f55\u500b\u304f\u3089\u3044\u3042\u308b\u304b\u300d<\/strong>\u3084<strong>\u300c\u4e00\u5ea6\u306b\u4f55\u500b\u62bd\u51fa\u3057\u305f\u3044\u304b\u300d<\/strong>\u3092\u6559\u3048\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3001\u3088\u308a\u6700\u9069\u306a\u30b3\u30fc\u30c9\u306b\u8abf\u6574\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1\u5ea6\u306b\u62bd\u51fa\u3059\u308b\u306e\u306f1\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3002\u5bfe\u8c61\u306e\u30d5\u30a9\u30eb\u30c0\u306f\u73fe\u5728500\u500b\u3050\u3089\u3044\u3067\u5897\u3048\u308b\u4e88\u5b9a\u3002<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u5bfe\u8c61\u30d5\u30a9\u30eb\u30c0\u304c500\u500b\u4ee5\u4e0a\u3042\u308a\u3001\u4eca\u5f8c\u3082\u5897\u3048\u308b\u4e88\u5b9a\u3068\u306e\u3053\u3068\u3067\u3059\u306e\u3067\u3001\u52d5\u4f5c\u306e\u8efd\u5feb\u3055\u3068\u5805\u7262\u6027\u3092\u91cd\u8996\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u4f8b\u3092\u63d0\u793a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu Server\u3067\u6a19\u6e96\u7684\u306b\u5229\u7528\u3067\u304d\u308b\u00a0<code>shuf<\/code>\u00a0\u30b3\u30de\u30f3\u30c9\u306f\u3001\u6570\u767e\u301c\u6570\u5343\u7a0b\u5ea6\u306e\u9805\u76ee\u6570\u3067\u3042\u308c\u3070\u4e00\u77ac\u3067\u51e6\u7406\u304c\u5b8c\u4e86\u3059\u308b\u305f\u3081\u3001\u975e\u5e38\u306b\u52b9\u7387\u7684\u3067\u3059\u3002\u00a0<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u63a8\u5968\u3055\u308c\u308b\u5b9f\u884c\u30b3\u30de\u30f3\u30c9<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f8c\u7d9a\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3078\u78ba\u5b9f\u306b\u30d1\u30b9\u3092\u6e21\u3059\u305f\u3081\u3001\u4ee5\u4e0b\u306e\u66f8\u304d\u65b9\u3092\u63a8\u5968\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># 1. \u30e9\u30f3\u30c0\u30e0\u306b1\u3064\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u62bd\u51fa\u3057\u3066\u5909\u6570\u306b\u683c\u7d0d<\/em>\n<em># 2. \u305d\u306e\u30d5\u30a9\u30eb\u30c0\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306e\u307f\u3001\u81ea\u4f5c\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c<\/em>\ntarget_dir=$(find \/path\/to\/parent_dir -mindepth 1 -maxdepth 1 -type d | shuf -n 1)\n\nif &#91; -n \"$target_dir\" ]; then\n    \/path\/to\/your_script.sh \"$target_dir\"\nelse\n    echo \"\u5bfe\u8c61\u306e\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\"\nfi\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u30dd\u30a4\u30f3\u30c8<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9ad8\u901f\u306a\u51e6\u7406<\/strong>:\u00a0<code>find<\/code>\u00a0\u3068\u00a0<code>shuf<\/code>\u00a0\u306e\u7d44\u307f\u5408\u308f\u305b\u306f\u3001\u6570\u5343\u500b\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u5bfe\u3057\u3066\u3082\u975e\u5e38\u306b\u9ad8\u901f\u306b\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u968e\u5c64\u306e\u56fa\u5b9a<\/strong>:\u00a0<code>-mindepth 1 -maxdepth 1<\/code>\u00a0\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u89aa\u30d5\u30a9\u30eb\u30c0\u81ea\u8eab\uff08<code>.<\/code>\uff09\u3092\u9664\u5916\u3057\u3001\u76f4\u4e0b\u306e\u5b50\u30d5\u30a9\u30eb\u30c0\u306e\u307f\u3092\u6b63\u78ba\u306b\u62bd\u51fa\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30b9\u30da\u30fc\u30b9\u5bfe\u5fdc<\/strong>: \u3082\u3057\u30d5\u30a9\u30eb\u30c0\u540d\u306b\u30b9\u30da\u30fc\u30b9\u304c\u542b\u307e\u308c\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u00a0<code>find<\/code>\u00a0\u306e\u00a0<code>-print0<\/code>\u00a0\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u00a0<code>shuf<\/code>\u00a0\u306e\u00a0<code>-z<\/code>\u00a0\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3068\u5b89\u5168\u3067\u3059\u3002\u00a0<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># \u30d5\u30a9\u30eb\u30c0\u540d\u306b\u30b9\u30da\u30fc\u30b9\u304c\u3042\u308b\u5834\u5408\u3067\u3082\u5b89\u5168\u306a\u66f8\u304d\u65b9<\/em>\ntarget_dir=$(find \/path\/to\/parent_dir -mindepth 1 -maxdepth 1 -type d -print0 | shuf -z -n 1 | tr -d '\\0')\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u65b9\u6cd5\u3067\u3042\u308c\u3070\u3001\u30d5\u30a9\u30eb\u30c0\u304c\u6570\u5343\u3001\u6570\u4e07\u3068\u5897\u3048\u3066\u3082 Ubuntu Server \u4e0a\u3067\u5b89\u5b9a\u3057\u3066\u52d5\u4f5c\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u62bd\u51fa\u3055\u308c\u305f\u30d5\u30a9\u30eb\u30c0\u306b\u5bfe\u3057\u3066\u3001<strong>\u3069\u306e\u3088\u3046\u306a\u983b\u5ea6\uff08cron\u306a\u3069\uff09\u3067\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3059\u308b\u4e88\u5b9a<\/strong>\u3067\u3059\u304b\uff1f\u8a2d\u5b9a\u65b9\u6cd5\u306b\u3064\u3044\u3066\u30b5\u30dd\u30fc\u30c8\u304c\u5fc5\u8981\u3067\u3042\u308c\u3070\u304a\u77e5\u3089\u305b\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e00\u65e5\u306b\uff11\u56de\u62bd\u51fa\u53ef\u80fd\u3067\u3042\u308c\u3070OK\u3067\u3059\u3002\u8d77\u52d5\u6642\u306b\u62bd\u51fa\u3057\u3066\u4ee5\u5f8c\uff11\u65e5\u305d\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u3044\u307e\u3059\u3002<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u300c\u8d77\u52d5\u6642\u306b1\u56de\u3060\u3051\u30e9\u30f3\u30c0\u30e0\u306b\u30d5\u30a9\u30eb\u30c0\u3092\u9078\u3073\u3001\u305d\u306e\u65e51\u65e5\u306f\u305d\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u3044\u7d9a\u3051\u308b\u300d\u3068\u3044\u3046\u904b\u7528\u3067\u3059\u306d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu Server\u3067\u3053\u308c\u3092\u5b9f\u73fe\u3059\u308b\u306b\u306f\u3001<strong>\u300c\u8d77\u52d5\u6642\u306b\u30e9\u30f3\u30c0\u30e0\u62bd\u51fa\u3057\u3066\u7d50\u679c\u3092\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\u3059\u308b\u300d<\/strong>\u4ed5\u7d44\u307f\u3092\u4f5c\u308b\u306e\u304c\u6700\u3082\u78ba\u5b9f\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. \u8d77\u52d5\u6642\u306b\u30d5\u30a9\u30eb\u30c0\u3092\u56fa\u5b9a\u3059\u308b\u4ed5\u7d44\u307f<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u307e\u305a\u3001\u8d77\u52d5\u6642\u306b\u30e9\u30f3\u30c0\u30e0\u30671\u3064\u30d5\u30a9\u30eb\u30c0\u3092\u9078\u3073\u3001\u305d\u306e\u30d1\u30b9\u3092&nbsp;<code>\/tmp\/today_folder.txt<\/code>&nbsp;\u306a\u3069\u306e\u56fa\u5b9a\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3059\u8a2d\u5b9a\u3092\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u624b\u9806 A: \u62bd\u51fa\u7528\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u4f5c\u6210<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>\/usr\/local\/bin\/select_today_folder.sh<\/code>&nbsp;\u3068\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>#!\/bin\/bash<\/em>\n<em># \u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d1\u30b9<\/em>\nPARENT_DIR=\"\/path\/to\/parent_dir\"\n<em># \u7d50\u679c\u3092\u4fdd\u5b58\u3059\u308b\u4e00\u6642\u30d5\u30a1\u30a4\u30eb<\/em>\nSAVE_FILE=\"\/tmp\/today_folder.txt\"\n\n<em># \u30e9\u30f3\u30c0\u30e0\u306b1\u3064\u9078\u3093\u3067\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58<\/em>\nfind \"$PARENT_DIR\" -mindepth 1 -maxdepth 1 -type d | shuf -n 1 &gt; \"$SAVE_FILE\"\n\n<em># \u9078\u3070\u308c\u305f\u30d5\u30a9\u30eb\u30c0\u306b\u5bfe\u3057\u3066\u81ea\u4f5c\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c<\/em>\nTARGET=$(cat \"$SAVE_FILE\")\nif &#91; -n \"$TARGET\" ]; then\n    \/path\/to\/your_script.sh \"$TARGET\"\nfi\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f5c\u6210\u5f8c\u3001\u5b9f\u884c\u6a29\u9650\u3092\u4e0e\u3048\u307e\u3059\uff1a&nbsp;<code>sudo chmod +x \/usr\/local\/bin\/select_today_folder.sh<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u624b\u9806 B: \u8d77\u52d5\u6642\u306b\u5b9f\u884c\u3055\u305b\u308b (crontab)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ubuntu Server\u3067\u6700\u3082\u624b\u8efd\u306a\u306e\u306f&nbsp;<code>cron<\/code>&nbsp;\u306e&nbsp;<code>@reboot<\/code>&nbsp;\u6307\u5b9a\u3067\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>crontab -e<\/code>\u00a0\u3092\u5b9f\u884c\u3002<\/li>\n\n\n\n<li>\u672b\u5c3e\u306b\u4ee5\u4e0b\u3092\u8ffd\u8a18\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002bash<code>@reboot \/usr\/local\/bin\/select_today_folder.sh <\/code><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">2. \u305d\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u300c1\u65e5\u4e2d\u300d\u4f7f\u3046\u65b9\u6cd5<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ed6\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3084\u30b3\u30de\u30f3\u30c9\u304b\u3089\u300c\u4eca\u65e5\u9078\u3070\u308c\u305f\u30d5\u30a9\u30eb\u30c0\u300d\u3092\u53c2\u7167\u3057\u305f\u3044\u3068\u304d\u306f\u3001\u5148\u307b\u3069\u66f8\u304d\u51fa\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u3060\u3051\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f8b\uff1a\u4ed6\u306e\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089\u4f7f\u3046\u5834\u5408<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">bash<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em># \u4eca\u65e5\u9078\u3070\u308c\u305f\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9\u3092\u5909\u6570\u306b\u8aad\u307f\u8fbc\u3080<\/em>\nTODAY_DIR=$(cat \/tmp\/today_folder.txt)\n\necho \"\u672c\u65e5\u306e\u5bfe\u8c61\u30d5\u30a9\u30eb\u30c0\u306f $TODAY_DIR \u3067\u3059\u3002\"\n<em># \u4ee5\u964d\u3001\u3053\u306e $TODAY_DIR \u3092\u4f7f\u3063\u3066\u51e6\u7406\u3092\u884c\u3046<\/em>\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u65b9\u6cd5\u306e\u30e1\u30ea\u30c3\u30c8<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u4e00\u5ea6\u6c7a\u307e\u3063\u305f\u3089\u5909\u308f\u3089\u306a\u3044<\/strong>:\u00a0<code>\/tmp<\/code>\u00a0\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u51fa\u3059\u305f\u3081\u3001OS\u3092\u518d\u8d77\u52d5\u3057\u306a\u3044\u9650\u308a\u3001\u305d\u306e\u65e5\u306f\u305a\u3063\u3068\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u3092\u6307\u3057\u793a\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u518d\u8a66\u884c\u304c\u7c21\u5358<\/strong>: \u3082\u3057\u624b\u52d5\u3067\u9078\u3073\u76f4\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u518d\u5ea6\u53e9\u304f\u3060\u3051\u3067\u00a0<code>\/tmp\/today_folder.txt<\/code>\u00a0\u304c\u66f4\u65b0\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li><strong>\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u6027<\/strong>: \u30d5\u30a9\u30eb\u30c0\u304c500\u500b\u304b\u3089\u6570\u5343\u500b\u306b\u5897\u3048\u3066\u3082\u3001<code>find<\/code>\u00a0\u3068\u00a0<code>shuf<\/code>\u00a0\u306f\u4e00\u77ac\u3067\u51e6\u7406\u3092\u7d42\u3048\u308b\u305f\u3081\u3001\u8d77\u52d5\u6642\u9593\u3092\u9045\u5ef6\u3055\u305b\u307e\u305b\u3093\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u3082\u3057\u300c\u30b5\u30fc\u30d0\u30fc\u3092\u6570\u65e5\u9593\u8d77\u52d5\u3057\u3063\u3071\u306a\u3057\u306b\u3059\u308b\u300d\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408\u306f\u3001<code>@reboot<\/code>&nbsp;\u306e\u4ee3\u308f\u308a\u306b<strong>\u6bce\u65e5\u6c7a\u307e\u3063\u305f\u6642\u9593\uff08\u6df1\u591c0\u6642\u306a\u3069\uff09\u306b\u66f4\u65b0\u3059\u308b<\/strong>\u8a2d\u5b9a\u3082\u53ef\u80fd\u3067\u3059\u3002\u5fc5\u8981\u3067\u3042\u308c\u3070\u3001\u305d\u306e\u8a2d\u5b9a\u65b9\u6cd5\u3082\u63d0\u793a\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u3044\u3048\u5927\u4e08\u592b\u3067\u3059\u3002\u3053\u306e\u65b9\u6cd5\u3092\u8a66\u3057\u3066\u307f\u307e\u3059\u3002\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u627f\u77e5\u3044\u305f\u3057\u307e\u3057\u305f\uff01\u305c\u3072\u305d\u306e\u65b9\u6cd5\u3067\u9032\u3081\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u3082\u3057\u5b9f\u969b\u306b\u52d5\u304b\u3057\u3066\u307f\u3066\u3001\u7279\u5b9a\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u9664\u5916\u3057\u305f\u304f\u306a\u3063\u305f\u308a\u3001\u5b9f\u884c\u7d50\u679c\u306e\u30ed\u30b0\u3092\u6b8b\u3057\u305f\u304f\u306a\u3063\u305f\u308a\u3059\u308b\u306a\u3069\u3001\u8ffd\u52a0\u306e\u8981\u671b\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3089\u3044\u3064\u3067\u3082\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f5c\u696d\u306e\u6210\u529f\u3092\u7948\u3063\u3066\u304a\u308a\u307e\u3059\uff01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u81ea\u4f5c\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5f15\u6570\u6e21\u3057<\/strong>\u3084<strong>\u30d1\u30b9\u306e\u6307\u5b9a<\/strong>\u3067\u8a70\u307e\u3063\u305f\u969b\u306a\u3069\u306f\u3001\u307e\u305f\u3044\u3064\u3067\u3082\u304a\u58f0\u304c\u3051\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ubuntu server\uff08Linux\uff09\u3067\u3001\u7279\u5b9a\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306b\u3042\u308b\u5b50\u30d5\u30a9\u30eb\u30c0\u3092\u30e9\u30f3\u30c0\u30e0\u306b\u62bd\u51fa\u3059\u308b\u65b9\u6cd5\u306f\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u3002 \u5f8c\u7d9a\u306e\u81ea\u4f5c\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u30d1\u30b9\u3092\u6e21\u3057\u3084\u3059\u3044\u3088\u3046\u3001\u30b7\u30f3\u30d7\u30eb\u3067\u5805\u7262\u306a\u624b\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 1.&#038;nbs&hellip;<\/p>\n","protected":false},"author":1,"featured_media":2135,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[24],"tags":[],"class_list":["post-2182","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai"],"_links":{"self":[{"href":"https:\/\/kaizawa.jp\/index.php?rest_route=\/wp\/v2\/posts\/2182","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kaizawa.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kaizawa.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kaizawa.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kaizawa.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2182"}],"version-history":[{"count":1,"href":"https:\/\/kaizawa.jp\/index.php?rest_route=\/wp\/v2\/posts\/2182\/revisions"}],"predecessor-version":[{"id":2186,"href":"https:\/\/kaizawa.jp\/index.php?rest_route=\/wp\/v2\/posts\/2182\/revisions\/2186"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kaizawa.jp\/index.php?rest_route=\/wp\/v2\/media\/2135"}],"wp:attachment":[{"href":"https:\/\/kaizawa.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kaizawa.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kaizawa.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}