Hi all,
i have a problem concerning init scripts and python.
What i have is a init script:
#!/bin/sh### BEGIN INIT INFO
# Provides: arelle
# Required-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start Arelle Webservice
### END INIT INFO
case "$1" in
start)
#su -c "python3 /opt/Arelle/arelleCmdLine.py --webserver localhost:8075"
su -c "/root/start_arelle.sh"
echo "arelle started"
;;
stop)
echo "not implemented yet"
;;
restart)
echo "not implemented yet"
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
This script resides in /etc/init.d. I’ve already added it to the runlevels using
chkconfig -a arelle
When i start the script in the console using
./arelle start
the arelle server starts without any issues. But when i restart my machine the server is not started! I’ve tested this using
netstat -nlp
Also i’ve written a separate file that just has the command commented out in the init file
#!/bin/sh
python3 /opt/Arelle/arelleCmdLine.py --webserver localhost:8075
Also this works!
To make sure that there is nothing wrong with the init script i’ve modified it:
#!/bin/sh
### BEGIN INIT INFO
# Provides: arelleTest
# Required-Start:
# Required-Stop:
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start Arelle Webservice
### END INIT INFO
case "$1" in
start)
su -c "touch /root/thisIsATest"
echo "arelle started"
;;
stop)
echo "not implemented yet"
;;
restart)
echo "not implemented yet"
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
As you can see, i’ve just added the touch command. This script is being executed during startup since the file exists after booting. So i guess there is an issue with the python command that starts the server. But the command as such works like a charm (also, as mentioned above, the init start works when executed by hand). Does anybody have any guess why this does not work during startup? Any ideas are very welcome! Is there any place where i can find maybe an error message in the logs?
Best regards,
Moe