Gentoo web2py daemon
Gentoo RC init script for web2py framework
Save as “/etc/init.d/web2py”
#!/sbin/runscript # Gentoo web2py init script WORK_PATH="/home/web2py" WORK_FILE="web2py.py" PYTHON="/usr/bin/python2.6" PIDFILE="/var/run/web2py.pid" PASSWORD="<recycle>" SRV_ADDR="0.0.0.0" SRV_PORT="8000" SRV_CRT="" SRV_KEY="" depend(){ need net } start() { ebegin "Starting web2py" start-stop-daemon --start --quiet --background --chdir "$WORK_PATH" \ --pidfile $PIDFILE --exec "$PYTHON" \ -- "$WORK_PATH/$WORK_FILE" \ --nogui --password="$PASSWORD" \ --pid_filename="$PIDFILE" \ --ip=$SRV_ADDR --port=$SRV_PORT \ --ssl_certificate="$SRV_CRT" --ssl_private_key="$SRV_KEY" eend $? } stop() { ebegin "Stopping web2py" start-stop-daemon --stop --pidfile $PIDFILE eend $? }
To make a file executable:
chmode +x /etc/init.d/web2py
Add to default runlevel:
rc-update add web2py default
Start daemon:
rc-config start web2py