Thursday, May 2, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1638  / 2 Years ago, thu, november 3, 2022, 11:20:14

When I start up this application called splashtop streamer by using python /opt/splashtop-streamer/SRStreamer.pyc at the prompt everything works fine.



However, when I add sh -c sleep 10; to the beginning of it, the application tells me it's already running and won't open the program. Why?



I'm trying to start the program 10 seconds into the boot of Ubuntu. When I use simply sleep 10; python /opt/splashtop-streamer/SRStreamer.pyc the application does not start. When I use sh -c sleep 10; python /opt/splashtop-streamer/SRStreamer.pyc the application comes up with the error message that another copy is already running, I click okay and it quits.



However it may be important to note that when I'm not booting up the sleep 10; python /opt/splashtop-streamer/SRStreamer.pyc command works fine.


More From » command-line

 Answers
2

I recommend that you try dumping this into a script instead of a single command.



I have taken the liberty of making a script for you. Feel free to use it. If not, a template is below to help you create your own:



#!/bin/sh

sleep n; #Causes computer to wait n seconds before moving on to the next line
python /path/to/python/script.py;


This will work because it runs everything in a single sh process. Basically, it's the exact same as typing both of those commands, one after the other, into a SH prompt.



Once you have the script and have saved it to a safe place. (I like /home/$USER/.bin/run-this.sh, run this command in your terminal (any terminal):



chmod 755 /home/$USER/.bin/run-this.sh


Finally, add it to whatever boot-time solution you want, such as "Startup Items", init, rc.d, or whatever.


[#23188] Friday, November 4, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
barted

Total Points: 424
Total Questions: 103
Total Answers: 101

Location: Djibouti
Member since Sun, Feb 27, 2022
2 Years ago
barted questions
;