Re: shell script run in backend

2023-05-14 Thread Greg Wooledge
On Sun, May 14, 2023 at 04:36:03PM +, Andy Smith wrote: > On Sun, May 14, 2023 at 05:04:50PM +0800, Tom Reed wrote: > > I know convert it to a perl script and run it under App::Daemon for > > background jobs. > > Having it as a systemd service is a much cleaner solution, whether > it is shell

Re: shell script run in backend

2023-05-14 Thread Andy Smith
Hello, On Sun, May 14, 2023 at 05:04:50PM +0800, Tom Reed wrote: > I know convert it to a perl script and run it under App::Daemon for > background jobs. Having it as a systemd service is a much cleaner solution, whether it is shell or Perl or any other language. The main point of the

Re: shell script run in backend

2023-05-14 Thread Tom Reed
stem service as Jeremy Ardley suggests in a different reply. > > Exactly: > > script > /tmp/script.log 2>&1 & > > (adjust paths to taste). For good measure, and if your shell > has job control, it will output the job number and PID, like > so: > > [1] 15211 > > (1 is the job number, 15211 is

Re: shell script run in backend

2023-05-14 Thread tomas
On Sun, May 14, 2023 at 12:20:02AM -0700, Will Mengarini wrote: > * Tom Reed [23-05/14=Sun 14:21 +0800]: > > I have a long run shell script [...]. Currently the script > > is running in front-end in shell. How can I run it with > > the backend way? Can I register it as a system service? > >

Re: shell script run in backend

2023-05-14 Thread Will Mengarini
* Tom Reed [23-05/14=Sun 14:21 +0800]: > I have a long run shell script [...]. Currently the script > is running in front-end in shell. How can I run it with > the backend way? Can I register it as a system service? Just run 'myScript&' (the trailing '&' tells the shell to run it in the

Re: shell script run in backend

2023-05-14 Thread Jeremy Ardley
On 14/5/23 14:21, Tom Reed wrote: Currently the script is running in front-end in shell. How can I run it with the backend way? can I register it as a system service? sudo nano /etc/systemd/system/myscript.service [Unit] Description=My Script [Service] ExecStart=/path/to/your/script.sh

shell script run in backend

2023-05-14 Thread Tom Reed
Hello list I have a long run shell script with similar content, #!/bin/bash while [ 1 ];do func1() func2() sleep 5 done Currently the script is running in front-end in shell. How can I run it with the backend way? can I register it as a system service? Thanks