Skip to content

Instantly share code, notes, and snippets.

@sairon
Last active February 9, 2024 10:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sairon/12a7cff21d28080e8069 to your computer and use it in GitHub Desktop.
Save sairon/12a7cff21d28080e8069 to your computer and use it in GitHub Desktop.
Simple OpenWrt procd init script for Python scripts
#!/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
}
@manu354
Copy link

manu354 commented Mar 19, 2016

Do you need to have the START and STOP values?

@craigphicks
Copy link

Did redirecting stdout/stderr to logd not work? I have that problem.

# procd_set_param stdout 1
# procd_set_param stderr 1

@toporivskiy
Copy link

for me works:
procd_set_param command /usr/bin/python3 "$SCRIPT"

@albertogaona
Copy link

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

@franzflasch
Copy link

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