Last active
February 9, 2024 10:35
-
-
Save sairon/12a7cff21d28080e8069 to your computer and use it in GitHub Desktop.
Simple OpenWrt procd init script for Python scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh /etc/rc.common | |
# Copyright (C) 2015 CZ.NIC z.s.p.o. (http://www.nic.cz/) | |
START=99 | |
STOP=0 | |
USE_PROCD=1 | |
SCRIPT="/root/pokus.py" | |
start_service() { | |
procd_open_instance | |
procd_set_param command python "$SCRIPT" | |
# procd_set_param stdout 1 | |
# procd_set_param stderr 1 | |
procd_close_instance | |
} |
Did redirecting stdout/stderr to logd not work? I have that problem.
# procd_set_param stdout 1
# procd_set_param stderr 1
for me works:
procd_set_param command /usr/bin/python3 "$SCRIPT"
Do you need to have the START and STOP values?
Reference says START is 'kind of' mandatory whilst STOP is optional https://openwrt.org/docs/techref/initscripts
Did redirecting stdout/stderr to logd not work? I have that problem.
# procd_set_param stdout 1 # procd_set_param stderr 1
late to the game, but I had a similar problem. you can try with flushing e.g. "print('foo', flush=True)" in your python script
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you need to have the START and STOP values?