Warning: Cannot modify header information - headers already sent by (output started at /home/cra-log/www/index.php:1) in /home/cra-log/www/site-admin-wp/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/cra-log/www/index.php:1) in /home/cra-log/www/site-admin-wp/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/cra-log/www/index.php:1) in /home/cra-log/www/site-admin-wp/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/cra-log/www/index.php:1) in /home/cra-log/www/site-admin-wp/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/cra-log/www/index.php:1) in /home/cra-log/www/site-admin-wp/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/cra-log/www/index.php:1) in /home/cra-log/www/site-admin-wp/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/cra-log/www/index.php:1) in /home/cra-log/www/site-admin-wp/wp-includes/rest-api/class-wp-rest-server.php on line 1775

Warning: Cannot modify header information - headers already sent by (output started at /home/cra-log/www/index.php:1) in /home/cra-log/www/site-admin-wp/wp-includes/rest-api/class-wp-rest-server.php on line 1775
{"id":221,"date":"2020-06-09T23:56:49","date_gmt":"2020-06-09T14:56:49","guid":{"rendered":"https:\/\/cra-log.sakura.ne.jp\/?p=221"},"modified":"2023-08-15T21:11:06","modified_gmt":"2023-08-15T12:11:06","slug":"raspberrypi-camera-routine","status":"publish","type":"post","link":"https:\/\/craft-gogo.com\/raspberrypi-camera-routine\/","title":{"rendered":"\u3010Raspberry Pi\u3011 cron\u3092\u4f7f\u3063\u3066\u5199\u771f\u3092\u5b9a\u671f\u7684\u306b\u64ae\u5f71"},"content":{"rendered":"\n

\u524d\u56de\u306e\u8a18\u4e8b<\/a>\u3067\u306f\u3001Raspberry Pi\u7528Camera Module V2\u3092\u4f7f\u3063\u3066\u5199\u771f\u3092\u64ae\u5f71\u3059\u308b\u3053\u3068\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306fcron\u3068\u3044\u3046\u30c7\u30fc\u30e2\u30f3\u3092\u4f7f\u3063\u3066\u5199\u771f\u3092\u5b9a\u671f\u7684\u306b\u64ae\u3063\u3066\u307f\u307e\u3059\u3002\u3053\u308c\u304c\u51fa\u6765\u308b\u3068\u690d\u7269\u306a\u3069\u306e\u89b3\u5bdf\u306b\u5f79\u7acb\u3064\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n

\u5199\u771f\u64ae\u5f71\u7528\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u6e96\u5099\u3057\u3001cron\u306e\u8a2d\u5b9a\u3001\u5b9f\u884c\u3068\u3044\u3063\u305f\u6d41\u308c\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n

cron\u3068\u306f<\/h2>\n\n\n\n

\u8a2d\u5b9a\u3057\u305f\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u5f93\u3063\u3066\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u81ea\u52d5\u5b9f\u884c\u3057\u3066\u304f\u308c\u308b\u30c7\u30fc\u30e2\u30f3(\u5e38\u99d0\u30d7\u30ed\u30b0\u30e9\u30e0)\u3067\u3059\u3002\u300ccrontab\u300d\u3068\u3044\u3046\u30b3\u30de\u30f3\u30c9\u3067\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

\u5199\u771f\u64ae\u5f71\u7528\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u6e96\u5099<\/h2>\n\n\n\n

cron\u3092\u8a2d\u5b9a\u3059\u308b\u524d\u306b\u3001\u5b9f\u884c\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u6e96\u5099\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

rpicamera.sh\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n

!\/bin\/bash\nDATE=$(date +"%Y-%m-%d_%H%M")\nraspistill -o \/home\/pi\/rpicamera\/$DATE.jpg<\/code><\/pre><\/div>\n\n\n\n

\u5b9f\u884c\u3057\u305f\u77ac\u9593\u306e\u5199\u771f\u304c\u30d5\u30a1\u30a4\u30eb\u540d\u300cYear-Month-Day_HourMinute.jpg\u300d\u3067\u4fdd\u5b58\u3055\u308c\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u3059\u3002<\/p>\n\n\n\n

cron\u306e\u8a2d\u5b9a<\/h2>\n\n\n\n

\u6e96\u5099\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9a\u671f\u7684\u306b\u5b9f\u884c\u3059\u308b\u305f\u3081\u3001crontab\u30d5\u30a1\u30a4\u30eb\u306b\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n

crontab\u30d5\u30a1\u30a4\u30eb\u306f\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3064\u3053\u3068\u3067\u958b\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n

$ crontab -e<\/code><\/pre><\/div>\n\n\n\n

\u81ea\u52d5\u5b9f\u884c\u3059\u308b\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306f\u4ee5\u4e0b\u306e\u30d5\u30a9\u30fc\u30de\u30c3\u30c8\u3067\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

\u5206 \u6642 \u65e5 \u6708 \u66dc\u65e5 \u5b9f\u884c\u3055\u308c\u308b\u30b3\u30de\u30f3\u30c9<\/code><\/pre><\/div>\n\n\n\n

\u6307\u5b9a\u3059\u308b\u5024\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n

\u6307\u5b9a\u5bfe\u8c61<\/th>\u7bc4\u56f2<\/th><\/tr><\/thead>
\u5206<\/td>0-59<\/td><\/tr>
\u6642<\/td>0-23<\/td><\/tr>
\u65e5<\/td>1-31<\/td><\/tr>
\u6708<\/td>1-12<\/td><\/tr>
\u66dc\u65e5<\/td>0-6 (0:\u65e5, 1:\u6708, 2:\u706b, 3:\u6c34, 4:\u6728, 5:\u91d1, 6:\u571f)<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u8907\u6570\u306e\u5024\u3092\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408\u306f\u3001,(\u30b3\u30f3\u30de)\u3001-(\u30c0\u30c3\u30b7\u30e5)\u3001*(\u30a2\u30b9\u30bf\u30ea\u30b9\u30af)\u3001\/(\u30b9\u30e9\u30c3\u30b7\u30e5)\u3092\u7528\u3044\u307e\u3059\u3002<\/p>\n\n\n\n

\u8a18\u53f7<\/th>\u6307\u5b9a\u5185\u5bb9<\/th>\u8a2d\u5b9a\u4f8b<\/th>\u5b9f\u969b\u306e\u5024<\/th><\/tr><\/thead>
, <\/td>\u30ea\u30b9\u30c8\u6307\u5b9a<\/td>1,3,5<\/td>1,3,5<\/td><\/tr>
–<\/td>\u7bc4\u56f2\u6307\u5b9a<\/td>1-5<\/td>1,2,3,4,5<\/td><\/tr>
*<\/td>\u3059\u3079\u3066\u306e\u5024<\/td>*<\/td>0,1,2,3, …<\/td><\/tr>
\/<\/td>\u9593\u9694\u6307\u5b9a<\/td>*\/3<\/td>0,3,6,9, …<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u4f8b\u3048\u3070\u3001\u5e73\u65e5\u30013\u6642\u9593\u3054\u3068\u306b\u5199\u771f\u3092\u64ae\u308a\u305f\u3044\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3068\u304a\u308acrontab\u30d5\u30a1\u30a4\u30eb\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

0 *\/3 * * 1-5 \/home\/pi\/rpicamera\/rpicamera.sh<\/code><\/pre><\/div>\n\n\n\n

cron\u306e\u5b9f\u884c<\/h2>\n\n\n\n

cron\u306e\u8d77\u52d5\u72b6\u614b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

\/etc\/init.d\/cron status<\/code><\/pre><\/div>\n\n\n\n

Active\u3067\u3042\u308c\u3070\u3001\u6307\u5b9a\u3057\u305f\u6642\u9593\u306b\u5199\u771f\u304c\u64ae\u3089\u308c\u3001\u6307\u5b9a\u30d5\u30a9\u30eb\u30c0\u306b\u5199\u771f\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n

cron\u304c\u8d77\u52d5\u3057\u3066\u3044\u306a\u3051\u308c\u3070\u3001\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u6253\u3061\u3001\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n\n\n\n

sudo \/etc\/init.d\/cron start<\/code><\/pre><\/div>\n\n\n\n

\u307e\u3068\u3081<\/h2>\n\n\n\n

Raspberry Pi\u3067\u5199\u771f\u3092\u81ea\u52d5\u7684\u306b\u64ae\u5f71\u3059\u308b\u305f\u3081\u3001cron\u3068\u3044\u3046\u30c7\u30fc\u30e2\u30f3\u3092\u4f7f\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n

\u5b9a\u671f\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u3051\u3070\u3001\u690d\u7269\u306a\u3069\u306e\u5b9a\u671f\u89b3\u5bdf\u306b\u5f79\u7acb\u3064\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n