Sample Header Ad - 728x90

Startup script to run a shell script as daemon

1 vote
2 answers
9916 views
I am using Debian Stretch with systemd version 231-9. I need to run some shell scripts and non-daemon programs in background even when I logout. I used to make simple init.d scripts with LSB header and then case with start option that simply executes "my_script.sh >> /var/log/my_script.log 2>&1 &" to run my_script.sh in background but now Systemd kills them once I close the terminal no matter what I try: &, nohup, setsid, disown. Can you help me to give a recipe for a proper init.d script that makes any script or non-daemon program run as daemon? Thank you.
Asked by spatar (111 rep)
Nov 3, 2016, 06:30 PM
Last activity: Nov 3, 2016, 10:33 PM