reboot_everyday
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[FrontPage]]
* systemd [#wdf03b32]
/etc/systemd/system
sudo emacs reboot.service
#code(){{
[Unit]
Description = Reboot
RefuseManualStart = true
RefuseManualStop = true
[Service]
ExecStart = /sbin/reboot
}}
sudo emacs reboot.timer
#code(){{
[Unit]
Description = Weekly Reboot Timer
[Timer]
OnCalendar=*-*-* 10:05:00
[Install]
WantedBy = timers.target
}}
sudo systemctl enable reboot.timer
sudo systemctl start reboot.timer
sudo emacs wiki_bot.service
#code(){{
[Unit]
Description=wiki_bot
After=network.target
[Service]
User=pi
Type=simple
WorkingDirectory=/home/pi/python
ExecStart=/home/pi/python/start_wiki_bot.sh
[Install]
WantedBy=multi-user.target
}}
sudo systemctl enable wiki_bot.service
emacs /home/pi/python/start_wiki_bot.sh
chmod 755 /home/pi/python/start_wiki_bot.sh
#code(){{
#!/bin/sh
sleep 120
xhost +
export DISPLAY=:0.0
python3 wiki_bot_02.py -s
}}
requests_toolbelt, pyserial は、仮想環境でpip3しないと入...
仮想環境の構築
https://blog.piwheels.org/debian-bookworm-and-raspberry-p...
を参考に
$ sudo apt install virtualenv python3-virtualenv -y
$ virtualenv -p /usr/bin/python3 testpip
を実行して環境を構築。
$ source testpip/bin/activate
を実行して仮想環境に入る。
pip3 install requests_toolbelt
pip3 install pyserial
で requests_toolbelt と pyserial を install
wiki_bot_03.py を仮想環境で起動。
仮想環境で起動する場合の start_wiki_bot.sh
#code(){{
#!/usr/bin/bash
sleep 120
xhost +
export DISPLAY=:0.0
cd /home/pi/python
source testpip/bin/activate
python3 wiki_bot_04.py -s
}}
----
#counter
終了行:
[[FrontPage]]
* systemd [#wdf03b32]
/etc/systemd/system
sudo emacs reboot.service
#code(){{
[Unit]
Description = Reboot
RefuseManualStart = true
RefuseManualStop = true
[Service]
ExecStart = /sbin/reboot
}}
sudo emacs reboot.timer
#code(){{
[Unit]
Description = Weekly Reboot Timer
[Timer]
OnCalendar=*-*-* 10:05:00
[Install]
WantedBy = timers.target
}}
sudo systemctl enable reboot.timer
sudo systemctl start reboot.timer
sudo emacs wiki_bot.service
#code(){{
[Unit]
Description=wiki_bot
After=network.target
[Service]
User=pi
Type=simple
WorkingDirectory=/home/pi/python
ExecStart=/home/pi/python/start_wiki_bot.sh
[Install]
WantedBy=multi-user.target
}}
sudo systemctl enable wiki_bot.service
emacs /home/pi/python/start_wiki_bot.sh
chmod 755 /home/pi/python/start_wiki_bot.sh
#code(){{
#!/bin/sh
sleep 120
xhost +
export DISPLAY=:0.0
python3 wiki_bot_02.py -s
}}
requests_toolbelt, pyserial は、仮想環境でpip3しないと入...
仮想環境の構築
https://blog.piwheels.org/debian-bookworm-and-raspberry-p...
を参考に
$ sudo apt install virtualenv python3-virtualenv -y
$ virtualenv -p /usr/bin/python3 testpip
を実行して環境を構築。
$ source testpip/bin/activate
を実行して仮想環境に入る。
pip3 install requests_toolbelt
pip3 install pyserial
で requests_toolbelt と pyserial を install
wiki_bot_03.py を仮想環境で起動。
仮想環境で起動する場合の start_wiki_bot.sh
#code(){{
#!/usr/bin/bash
sleep 120
xhost +
export DISPLAY=:0.0
cd /home/pi/python
source testpip/bin/activate
python3 wiki_bot_04.py -s
}}
----
#counter
ページ名: