Custom script to run ONCE, AFTER Transmission fully started

I’d like to run a custom script in the Transmission container once, after Transmission is fully started. I struggled for days with a custom script in /custom-cont-init.d, but eventually found that the script was waiting for Transmission to be ready, while Transmission was waiting for the script to finish before completing initialization.

This page was very helpful, but not enough detail to get me going. I turned to a custom service instead, in /custom-services.d. I simply mounted a folder on the host, with my script, as that folder. The script completed successfully, but it kept repeating. I experimented with adding a oneshot type file and other things, but couldn’t keep it to one run.

How can I run this script once, like a custom script, but after Transmission is fully going, like a custom service?

I worked around this by putting the script in /custom-services.d, so it launches after Transmission is loaded, but I end the script with sleep infinity, so it never quits and thus won’t be relaunched by the system. But I imagine there is a more elegant way?

1 Like