Skip to content

Commit b8bdbb4

Browse files
committed
Document running periodic data import with systemd
Signed-off-by: Haiko Schol <hs@haikoschol.com>
1 parent 8185bdb commit b8bdbb4

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,37 @@ DJANGO_DEV=1 python manage.py test vulnerabilities/tests
6868
DJANGO_DEV=1 python manage.py import --all
6969
```
7070

71+
If you want to run the import periodically, you can use a systemd timer:
72+
73+
```
74+
$ cat ~/.config/systemd/user/vulnerablecode.service
75+
76+
[Unit]
77+
Description=Update vulnerability database
78+
79+
[Service]
80+
Type=oneshot
81+
Environment="DJANGO_DEV=1"
82+
ExecStart=/path/to/venv/bin/python /path/to/vulnerablecode/manage.py import --all
83+
84+
$ cat ~/.config/systemd/user/vulnerablecode.timer
85+
86+
[Unit]
87+
Description=Periodically update vulnerability database
88+
89+
[Timer]
90+
OnCalendar=daily
91+
92+
[Install]
93+
WantedBy=multi-user.target
94+
```
95+
96+
Start it with
97+
98+
```
99+
systemctl --user daemon-reload && systemctl --user start vulnerablecode.timer
100+
```
101+
71102
## API
72103

73104
Start the webserver

0 commit comments

Comments
 (0)