Thread
:
Best way to make a startup script?
View Single Post
alci
2014-03-23 , 17:53
Posts: 24 | Thanked: 7 times | Joined on Nov 2011
#
6
I big thank you for this, works like a charm.
I made it even simplier as I just want my home be mounted on my sdcard, and I know it is here.
[nemo@localhost ~]$ cat /usr/sbin/mount-sd-home.sh
#!/bin/bash
ACTION=$1
if [ "$ACTION" = "add" ]; then
if [ $(mount | grep -c /mnt/sdhome) != 1 ]; then
mount -o noatime,rw,autodefrag /dev/mmcblk1p1 /mnt/sdhome
mount -o bind /mnt/sdhome/.home /home/nemo
mount -o bind /mnt/sdhome/.android /data/sdcard
fi
else
umount /data/sdcard
umount /home/nemo
umount /mnt/sdhome
fi
[nemo@localhost ~]$ cat /lib/systemd/system/mount-sd-home.service
[Unit]
Description=Handle home on sdcard
After=local-fs.target
RequiresMountsFor=/home
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/mount-sd-home.sh add
ExecStop=/usr/sbin/mount-sd-home.sh remove
[Install]
WantedBy=multi-user.target
Everything seems to work:
- ambiences
- new pictures and videos that I take are here and browsable
- settings are persited between reboots
A question, how did you pick the dependecies ?
(After=local-fs.target
RequiresMountsFor=/home)
Is there a doc somewhere I could look at to understand the boot process ?
Regards,
Franck
Quote & Reply
|
The Following 2 Users Say Thank You to alci For This Useful Post:
Leinad
,
meemorph
alci
View Public Profile
Send a private message to alci
Find all posts by alci