How to terminate screen from bash script?

Aero Maxx D aero.maxx.d at gmail.com
Tue Jul 19 21:35:54 UTC 2022


> On 19 Jul 2022, at 9:43 pm, Bo Berglund <bo.berglund at gmail.com> wrote:
> 
> I have a video editing script that cuts pieces out of a video file based on
> start,length time pairs on the command line.
> The script decodes the arguments and builds a big ffmpeg command to do the cut
> and concatenate using re-encode to make transitions smooth. This works fine but
> is a bit slow (takes 5-10 minutes per video).
> 
> So I am using screen to be able to work with the next video.
> 
> My process:
> - Find the cut points and lengths for the parts outside of screen
> - start screen
> - Make a call to the edit script with the proper arguments
> - Detach from screen using Ctrl A-D
> - Repeat above for the next video
> 
> In order for the screen session to terminate I have added the  following at the
> end of the script call command:  ; exit
> This causes the screen session to end when it is done so no ghost screens
> remain.
> 
> But it seems like the screen session termination should pe possible to add to
> the script itself, but I have not been successful in doing so...
> 
> So is there a way to finish a script running in screen with a screen termination
> command (exit) such that it will terminate the screen in which it runs?
> 
> I tried reading the man page but it is HUGE and very hard reading so I gave up.
> 
> All googling attempts I do bring up ways to *detatch* from the running screen
> window, but I want to *terminate* it automatically once the job is done...
> 
> 
> -- 
> Bo Berglund
> Developer in Sweden
> 
> 
> -- 
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

You could try using screen like this command

screen -d -m <your command here>



More information about the ubuntu-users mailing list