I have a script which monitors USB ports for connection of specific USB device then scrapes data off my ISP. I would like it to be run automatically and in the background once I login. Is this possible?
Login in what? The CLI, a GUI (and then wich DE?)? All of them?
Does it have to stop when you logout?
Who is “I”? A specific user I assume, or any user that logs in?
Let me rephrase: I would like it to be run automatically and in the background once any user logs in through GUI. I don’t know if the ‘DE’ matters since it (the script) does not have any GUI elements.
On 2017-03-17, giantas <giantas@no-mx.forums.microfocus.com> wrote:
> Let me rephrase: I would like it to be run automatically and in the
> background once any user logs in through GUI. I don’t know if the ‘DE’
> matters since it (the script) does not have any GUI elements.
I’m suspect it’s very trick to run a script only through any DE login without also being invoked upon TTY CLI login.
If you’re happy with both, this guide may be useful: http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/profile.html
…
It matters in so far that, that every Desktop has his own facilities to start applications on login. And those differ. So when you want to use those …
I am sorry, but your specifications are still not 100% clear to me.
- Do you mean that it must be started on every new login? (thus when 3 users are loging in each three times, there will be 9 instances of the program)
- Should it run only once for every user regardless how many times he is loged in? (In the above example thus3 instances)
- Or only once started on the first user login? (thus only one running)
And that brings us automatically to my earlier, unanswered question: what should happen on logout?
I assume, but that is only because of lack of other information from your site) that those processes will run owned by the user that started them. Please confirm.
I hope you understand that I am not even trying to offer you a solution at this moment. nor that I am sure there is one, as long as your specifications are not clear.
Very useful link, thank you. Will check it out.
OK. DE is KDE Plasma v5.5.5. Thank you for the first pointer (useful indeed). The script should run on boot, I guess, for I only need one instance for all users (and all logins). I expected that during logout the script would be terminated automatically (for now, I guess, its during shutdown). Any pointers on the same would be helpful. Kindly note the “Newcomer” badge https://forums.opensuse.org/images/icons/icon7.png
This is a bit confusing.
You original question was “on login”. Now you talk about “on boot”.
What do you want? Those are completely different things with completely different solutions.
When it is started on boot, then it will (when not stopping for some other reason) stop on shutdown (of course).
When it is started in the background on a login, it will be in the background and thus will not be killed on logout.
Please read all what we post careful. There was a question about the owner of that process. The user that log in, or root, or another user? You did NOT answer that.
Maybe you could try and take some time to formulate what you are trying to achieve. Read also the following advice at http://www.catb.org/~esr/faqs/smart-questions.html#goal. (there is more there, much, but not all, is applicable to these forums also).
Thank you for the helpful link. No thank you for not actually answering my question. I’ll post another thread if @flymail’s answer does not solve the problem. Note, however, that I my English was simple.
On 2017-03-17, giantas <giantas@no-mx.forums.microfocus.com> wrote:
> The script should run on boot, I guess,
You guess? What hcvv says is 100% correct - not just here but anytime (usually!). If you ask a vague question, expect a
vague response. Running a script on startup or on DE-indendent GUI login are completely different things (the latter
much trickier and probably never a good idea). Since openSUSE uses systemd, you may find link this useful for
configuring systemd…
https://linuxconfig.org/how-to-automatically-execute-shell-script-at-startup-boot-on-systemd-linux
… although knowing YaST’s brilliance, I suspect it probably has a configuration tool for this at different runlevels.
On 2017-03-17, giantas <giantas@no-mx.forums.microfocus.com> wrote:
> Kindly note the “Newcomer” badge
That information is not shown on the openSUSE forum’s usenet interface.