Unable to toggle dietpi-autostart_custom service using dietpi-services

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

  • DietPi version
    G_DIETPI_VERSION_CORE=9
    G_DIETPI_VERSION_SUB=7
    G_DIETPI_VERSION_RC=1
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’

  • Distro version
    bookworm

  • Kernel version
    Linux DietPi 6.1.0-25-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.106-3 (2024-08-26) x86_64 GNU/Linux

  • Architecture
    amd64

  • SBC model
    Native PC (x86_64) - Dell Wyse 5070

  • Power supply used
    OEM

As I understand from other forum posts

DietPi allows boot scripts via dietpi-config > AutoStart options > Custom. You need to add your command to /var/lib/dietpi-autostart/custom.sh
To stop it: systemctl stop dietpi-autostart_custom

The script works on boot, but it is not listed under dietpi-services, nor systemctl. I would like a way to toggle it, preferably with dietpi-services. How can I accomplish this?

#!/bin/bash
# DietPi-AutoStart custom script
# Location: /var/lib/dietpi/dietpi-autostart/custom.sh

cage -- bash -c 'wlr-randr --output X11-1 --custom-mode 1920x1080@60Hz>
        /usr/bin/waydroid show-full-ui $@ &'

exit 0
dietpi@DietPi:~$ sudo dietpi-autostart
[  OK  ] DietPi-AutoStart | Desired setting in /boot/dietpi.txt was already set: AUTO_SETUP_AUTOSTART_LOGIN_USER=dietpi
[  OK  ] DietPi-AutoStart | mkdir -p /etc/systemd/system/getty@tty1.service.d /etc/systemd/system/console-getty.service.d
[  OK  ] DietPi-AutoStart | systemctl daemon-reload
[  OK  ] DietPi-AutoStart | Desired setting in /boot/dietpi.txt was already set: AUTO_SETUP_AUTOSTART_LOGIN_USER=dietpi
[  OK  ] DietPi-AutoStart | mkdir -p /etc/systemd/system/getty@tty1.service.d /etc/systemd/system/console-getty.service.d
[  OK  ] DietPi-AutoStart | systemctl daemon-reload
 
dietpi@DietPi:~$ sudo systemctl stop dietpi-autostart_custom
Failed to stop dietpi-autostart_custom.service: Unit dietpi-autostart_custom.service not loaded.
dietpi@DietPi:~$ systemctl status dietpi-autostart_custom
Unit dietpi-autostart_custom.service could not be found.

dietpi@DietPi:~$ ps aux | grep waydroid
root         522  0.0  0.6 117700 23264 ?        Ssl  11:47   0:00 /usr/bin/python3 /usr/bin/waydroid -w container start
dnsmasq     3657  0.0  0.0  14180  2520 ?        S    11:48   0:00 dnsmasq --conf-file=/dev/null -u dnsmasq --strict-order --bind-interfaces --pid-file=/run/waydroid-lxc/dnsmasq.pid --listen-address 192.168.240.1 --dhcp-range 192.168.240.2,192.168.240.254 --dhcp-lease-max=253 --dhcp-no-override --except-interface=lo --interface=waydroid0 --dhcp-leasefile=/var/lib/misc/dnsmasq.waydroid0.leases --dhcp-authoritative
dietpi     69007  0.0  0.0   6336  2068 pts/5    S+   12:27   0:00 grep waydroid

Did you restart the device?
The service may be enabled after creation, but it’s executed on boot.
After a reboot you can add it then to dietpi-services, there is an option to add other services.

Probably a misunderstanding. DietPi Autostart is not a separate service. You will therefore not find it in the overview. The corresponding autostart script is executed by the boot routine. If you are looking for a way to switch a service on and off yourself, you might want to think about creating your own systemd service.

But but it creates a service to start the custom script
https://github.com/MichaIng/DietPi/blob/31d6a097af7e9861485c0407a72a3192ff727fd5/dietpi/dietpi-autostart#L70

This topic was automatically closed 178 days after the last reply. New replies are no longer allowed.