Python script start at boot

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
zkab

Python script start at boot

Post by zkab »

I want to start a python script when rebooting.
What I have is:
--------------------------------------------------------------------------------------------------
cat /etc/init.d/x-files_remote
#!/bin/sh

### BEGIN INIT INFO
# Provides: x-files_remote
# Required-Start: $all
# Required-Stop: $all
# Should-Start: $all
# Should-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start at boot och stop at shutdown
# Description: Start Remote Stick Server
### END INIT INFO

/home/jurka/my_scripts/remote_stick_server # Remote Stick Server
--------------------------------------------------------------------------------------------------
cat /home/jurka/my_scripts/remote_stick_server
#!/bin/sh

cd /home/jurka/remotestick-server
./remotestick-server.py -h 192.168.0.2 > /dev/null 2>&1 &
cd
--------------------------------------------------------------------------------------------------
I have also given sudo update-rc.d -f x-files_remote remove && sudo update-rc.d x-files_remote defaults
After reboot the script /etc/init.d/x-files_remote has not executed but when I give the command /etc/init.d/x-files_remote it works OK
What is wrong ?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Jamesc359

Re: Python script start at boot

Post by Jamesc359 »

Have you tried running update-rc.d x-files_remote defaults ?
zkab

Re: Python script start at boot

Post by zkab »

I did as you can see from my post above ...
zkab wrote: I have also given sudo update-rc.d -f x-files_remote remove && sudo update-rc.d x-files_remote defaults
Jamesc359

Re: Python script start at boot

Post by Jamesc359 »

Have you tried sending the output of emotestick-server.py to a file? Could it be that it's running before a necessary service is being provided?
zkab

Re: Python script start at boot

Post by zkab »

Jamesc359 wrote:Could it be that it's running before a necessary service is being provided?
I suspect that is the problem ... will look into that
Locked

Return to “Scripts & Bash”