![Ubuntu、Bluetooth経由でファイルを送信する](https://rvso.com/image/1496904/Ubuntu%E3%80%81Bluetooth%E7%B5%8C%E7%94%B1%E3%81%A7%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%82%92%E9%80%81%E4%BF%A1%E3%81%99%E3%82%8B.png)
read.txt
コマンドを使用して、という名前のファイルを送信しますbluetooth-sendto
。これは、ターミナルで直接コマンドを使用して機能しますbluetooth-sendto --device=MACADDR path/to/read.txt
。次の cron ジョブで実行します。
*/1 * * * * bluetooth-sendto --device=MACADDR path/to/read.txt
しかし、それは機能しません。このコマンドの出力をリダイレクトすると、空のファイルが生成されます。
*/1 * * * * bluetooth-sendto --device=MACADDR path/to/read.txt>path/to/err.log
ディレクトリとファイルの権限は 777 です。コマンドラインから直接コマンドを実行できる同じユーザーに対して cronjob が設定されます。 も試しましたsudo crontab -e
が、機能しませんでした。
cron ログ ファイルから:
Jun 16 14:26:01 localhost CRON[2023]: (user) CMD (bluetooth-sendto --device=xx:xx:xx:xx:xx:xx /home/user/read.txt)
Jun 16 14:26:01 localhost CRON[2016]: (CRON) info (No MTA installed, discarding output)
答え1
bluetooth-send
GUI アプリケーションであり、ヘッドレスまたは X 接続アドレスなしでは動作しません。
を使用することをお勧めしますussp-push
。コマンドは次のようになります。ussp-push 12:34:56:78:9A:BC@ localname remotename