Thomas_VDB
Contributor
- Joined
- Sep 22, 2012
- Messages
- 102
Hi all,
As the title says, I have created a small python script that reads a TCP socket, corrects the data and sends it back.
When I run the script in my jail via this command, it continues to run beautifully (until of course I close the session) :
Now I have made a rc.d startup script to run in after the boot of the jail :
After creating the startup script, I did'nt forget to :
chmod +x
and then enable the service
Now when I run the jail, I can see (on the other end of the socket-comm) the python script is executing perfectly.
But after 3 minutes it stops.
What could be the issue?
It doesn't stop when I run the python script manually. (but then it only runs as long as the terminal session exists).
As the title says, I have created a small python script that reads a TCP socket, corrects the data and sends it back.
When I run the script in my jail via this command, it continues to run beautifully (until of course I close the session) :
Code:
/usr/local/bin/python3.9 /root/mbgateway.py
Now I have made a rc.d startup script to run in after the boot of the jail :
After creating the startup script, I did'nt forget to :
chmod +x
and then enable the service
Code:
#!/bin/sh
#
# PROVIDE: mbgateway
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name="mbgateway"
rcvar="mbgateway_enable"
load_rc_config $name
start_cmd="${name}_start"
stop_cmd="${name}_stop"
mbgateway_start() {
echo "Starting mbgateway"
/usr/local/bin/python3.9 /root/mbgateway.py &
}
mbgateway_stop() {
echo "Stopping mbgateway"
# You might want to add logic here to stop the script gracefully
}
run_rc_command "$1"Now when I run the jail, I can see (on the other end of the socket-comm) the python script is executing perfectly.
But after 3 minutes it stops.
What could be the issue?
It doesn't stop when I run the python script manually. (but then it only runs as long as the terminal session exists).