インフラ
【Heroku】デプロイ直後にコマンドを実行する【Procfile編集】
例えば、Djangoのデプロイ時に、マイグレーションをしてほしいのであれば、 release: python manage.py migrate web: gunicorn config.wsgi:application --log-file - とする。 並列で処理を実行して欲しい場合 worker を使う。 release: python manage.py migrate worker: python manage.py custom_command web: gunicorn config.wsgi:application --log-file - 参照 https://devcenter.heroku.com/articles/procfile ...Nginxにrtmp-moduleを加えてmake install。ffmpegでRTMP配信する映像をVLCで再生【ライブストリーミング再生】
RTMPモジュールありのNginx(最新版)をmakeでインストールする。 https://nginx.org/en/download.html 最新版のnginxをインストールする wget https://nginx.org/download/nginx-1.25.5.tar.gz tar -zxvf nginx-1.25.5.tar.gz cd nginx-1.25.5 DLして、解凍したnginxディレクトリの中で、rtmp-moduleをGitHubからクローン git clone https://github.com/arut/nginx-rtmp-module.git rtmp-moduleのパスを --add-module引数に含めてビルドする。 ./configure --add-module=./nginx-rtmp-module make sudo make install これでインストールは完了したが、プロセスはまだ起動していない状態。127.0.0. ...UbuntuのBash(gnome-terminal)で新しいタブを開き、新しいタブでコマンドを実行する
【Ubuntu】systemdでPythonファイルを動作させる【常駐スクリプトに】
このPythonコードを動作させる。ファイルパスは~/Documents/systemd/test.py import datetime, time while True: with open("test.txt", mode="w") as f: f.write( str(datetime.datetime.now()) ) time.sleep(1) 必要最小限度の serviceファイルが以下。ファイルパスは/etc/systemd/system/testpython.serviceとする。 [Unit] Description=write text file After=network.target [Service] ExecStart=/usr/bin/python3 test.py WorkingDirectory=/home/testuser/Documents/systemd [Install] WantedBy=multi-user.target 下記で動作できる。 sudo systemctl start testpython.service 動作中は/home/testuser/Documents/systemd/te ...【Django】EC2インスタンスへgitを使ってデプロイする
poetryなしでDjangoをRender.comへデプロイする【Herokuの代替クラウド、アカウント作成から解説】
【LPIC】fileコマンドでMIMEタイプを調べておく
【LPIC】リダイレクションとは? 【>と<の違い、>>など】
【LPIC】trコマンドの使い方【標準入力したものを変換して出力する】
trコマンドは標準入力したものを変換して出力することができる。 例えば、以下のようにhelloをHelloに変換する tr "hello" "Hello" # tr hello Hello でも可 テキストファイルに書かれてある内容を置換して出力することができる。 tr hello Hello < test.txt 置換した内容を別のテキストファイルにリダイレクトして書き込みできる。 tr hello Hello < test.txt > test2.txt ちなみに、このように同じテキストにリダイレクトして書き込みしようとすると、このように全て消える。 tr hello Hello < test.txt > ...