I want to execute a script on startup. The script is recursive and calls itself.
When I added systemd unit for the same, it is executing but getting stopped in 1 min due to
DefaultTimeoutStartSec. It assumes that my script has not yet started.
Following is the service file I have created
[Unit] Description = My Desc After = network.target [Service] Type = forking ExecStart = /root/my_recursive_script.sh [Install] WantedBy = multi-user.target
I know I can make this service as working by adding
TimeoutSec to infinity but that would be workaround. When I execute my service with
systemctl start myservice.service
it does not leave the cursor until timeout encounter.
- What is the proper way to make systemd units work with recursive script?
- Do I need to make changes in my script to make it executable like daemon?