I'm trying to start the systemd service during boot once fstab entries mounted.
I have followed https://unix.stackexchange.com/questions/246935/set-systemd-service-to-execute-after-fstab-mount/570837#570837 and added below details
# cat /etc/fstab
/dev/mmcblk1p11 /data ext4 defaults 0 2
# systemctl list-units | grep '/data' | awk '{ print $1 }'
data.mount
# cat /usr/lib/systemd/system/data.service
[Unit]
Description=My system
After=data.mount
[Service]
Type=oneshot
ExecStartPre=mountpoint -q /data
ExecStart=/usr/etc/data.sh
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Problem is, it won't start during boot. However, the manual restart seems working.
# systemctl status data.service
data.service - My system
Loaded: loaded (/usr/lib/systemd/system/data.service; disabled; vendor preset: enabled)
Active: inactive (dead)
# systemctl enable data.service
Created symlink /etc/systemd/system/multi-user.target.wants/data.service ��→ /usr/lib/systemd/system/data.service.
# systemctl restart data.service
Starting My system...
[ OK ] Started My system.
Did I miss anything?
Asked by Jagan Teki
(11 rep)
Mar 3, 2020, 11:55 AM
Last activity: May 14, 2025, 05:04 PM
Last activity: May 14, 2025, 05:04 PM