Compare commits
4 Commits
2bf04c9e85
...
aad451f5ce
Author | SHA1 | Date | |
---|---|---|---|
aad451f5ce | |||
7807a9ee53 | |||
|
47c88140c3 | ||
|
10391fd746 |
@ -1,8 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
|
import datetime
|
||||||
import selenium.common.exceptions
|
import selenium.common.exceptions
|
||||||
import urllib3
|
|
||||||
import logging
|
import logging
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
@ -12,7 +12,7 @@ logging.basicConfig(
|
|||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
format="%(levelno)s - %(levelname)s - %(asctime)s - %(name)s - %(message)s",
|
format="%(levelno)s - %(levelname)s - %(asctime)s - %(name)s - %(message)s",
|
||||||
datefmt="%Y-%m-%d %H:%M:%S",
|
datefmt="%Y-%m-%d %H:%M:%S",
|
||||||
filename="log.log",
|
filename=f"logs/{datetime.date.today()}.log",
|
||||||
filemode="a"
|
filemode="a"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
18
README.md
18
README.md
@ -19,7 +19,23 @@ BUCT_AUTHENTICATION_PASSWORD=校园网密码
|
|||||||
## 关于service
|
## 关于service
|
||||||
|
|
||||||
由于用到了logging。所以service里面要加上`WorkingDirectory=/path/to/programe`来确保文件可以正常写入 。
|
由于用到了logging。所以service里面要加上`WorkingDirectory=/path/to/programe`来确保文件可以正常写入 。
|
||||||
出错先找找权限问题,我应该是直接给了755。
|
出错先找找权限问题,我应该是直接给了755。这里是一个servivce的配置文件例子。
|
||||||
|
```YAML
|
||||||
|
[Unit]
|
||||||
|
Description=Auto authentication.
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/path/to/your/python /path/to/your/program
|
||||||
|
WorkingDirectory=/path/to/your/program
|
||||||
|
User=Your_User
|
||||||
|
Restart=always
|
||||||
|
RestartSec=60
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user