I would like to have a .sh file run automatically when Linux starts. Screen is used in this .sh file.
I would do it with a cronjob
@reboot bash /path/to/my/file.sh
then sudo service cron start
https://wiki.ubuntuusers.de/Cron/
It doesn't work with my screen script in the .sh file.
What is a screen script? A script that uses the screen command?
Yes exactly
Why do you need screen there at all?
It doesn't run all the time without a screen, does it?
Yes, actually. You start it with cron - you don't have a terminal.
So can I start it without a screen? Then I can't see a console anymore, can I?
No, I think you can't see a console when you start this thing with Cron.
Is there any other option besides cron?
https://serverfault.com/questions/233084/how-do-i-use-crontab-to-start-a-screen-session
Yes you can use systemd. But you have to create a new user (runs in userspace)
Can you explain that please? Can you simply write a command into the system.conf?