File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 45
45
if [ " $SKIP_STARTUP_SCRIPTS " == " true" ]; then
46
46
echo " ↩️ Skipping startup scripts"
47
47
else
48
- for script in /opt/netbox/startup_scripts/* .py; do
49
- echo " ⚙️ Executing '$script '"
50
- ./manage.py shell --interface python < " ${script} "
51
- done
48
+ echo " import runpy; runpy.run_path('../startup_scripts')" | ./manage.py shell --interface python
52
49
fi
53
50
54
51
# copy static files
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+
3
+ import runpy
4
+ from os import scandir
5
+ from os .path import dirname , abspath
6
+
7
+ this_dir = dirname (abspath (__file__ ))
8
+
9
+ def filename (f ):
10
+ return f .name
11
+
12
+ with scandir (dirname (abspath (__file__ ))) as it :
13
+ for f in sorted (it , key = filename ):
14
+ if f .name .startswith ('__' ) or not f .is_file ():
15
+ continue
16
+
17
+ print (f"Running { f .path } " )
18
+ runpy .run_path (f .path )
You can’t perform that action at this time.
0 commit comments