start order services / "motion"

Hi guys,

I added “motion” to dietpi and added it to crontab. (@reboot motion) After that i noticed that “motion” doesn’t always launch after a reboot. I then added “sleep 60 & motion” to cron. That runs fine (every reboot). Now i noticed that (when i “dietpi-backup 1”) All services get stopped, but motion always keeps running.

How do i add “motion” to the dietpi-services? Is it possible to run it BEFORE lighttpd?

Greetz: Patrick

Allright, looked a little further: /DietPi/dietpi/.dietpi-services_include_exclude

But can i adjust the order in which the services are run?

ps: the reason for why i want “motion” to run before “lighttpd”: In Homeassistant i link to motion (webcams) and the images are perfectly synchronized WHEN motion is started before lighttpd is. When motion is started AFTER lighttpd, the images and the refresh of the website (homeassistant) are out of sync. (out of sync = images are blank for a couple of seconds)

ps: motion get’s stopped nicely now when i do a dietpi-backup but is not automatically started after the dietpi-backup (the other services are)

Currently it is not natively possible to order custom services into the hard coded services start schedule. They are always executed afterwards.

But you can manually edit /DietPi/dietpi/dietpi-services and hard code your service into the list, the long array where you find lighttpd inside as well. Simply add it as separate line before ‘lighttpd’.

Note that this is overwritten with every DietPi update, implementing a native solution should be possible (I have an idea), but could take one or two versions longer.

thnx for the info!