Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#31442 - Custom hooks not executed when using systemd for init

Attached to Project: Arch Linux
Opened by Dimitrios Apostolou (jimis) - Thursday, 06 September 2012, 20:41 GMT
Last edited by Eric Belanger (Snowman) - Friday, 07 September 2012, 22:59 GMT
Task Type Bug Report
Category System
Status Closed
Assigned To No-one
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I raised the issue on the ML but got no reply, so I'm assuming it's a systemd bug. Quoting myself:

I tried booting with systemd and two custom hooks I have that create the
/var directory on tmpfs didn't work. Google doesn't help here and my
experience with systemd is in its infancy, so is there specific action I
should take?

My custom hooks are set to run during sysinit_postmount and
shutdown_preumount, see attached file for full source.


Thanks in advance,
Dimitris


--- Custom hooks in /etc/rc.d/functions.d/

function varsync_start ()
{
# Assuming that we mounted /var as tmpfs in the previous step
stat_busy "Rsyncing /var-sync/ to /var/"
/usr/bin/rsync -ax /var-sync/ /var/
stat_done
}

function varsync_stop ()
{
# saving the /var filesystem from the tmpfs
echo -e 'y\ny' | /usr/bin/pacman -Scc >/dev/null
stat_busy "Rsyncing /var/ to /var-sync/"
/usr/bin/rsync -ax --delete /var/ /var-sync/
stat_done
}

add_hook sysinit_postmount varsync_start
add_hook shutdown_preumount varsync_stop
This task depends upon

Closed by  Eric Belanger (Snowman)
Friday, 07 September 2012, 22:59 GMT
Reason for closing:  Not a bug
Comment by Steven (Stebalien) - Friday, 07 September 2012, 03:15 GMT
Those hooks are specific to initscripts and won't be triggered by systemd.
Comment by Dimitrios Apostolou (jimis) - Friday, 07 September 2012, 21:57 GMT
OK I guess I'll stay with sysvinit then. Is there some equivalent mechanism for custom hooks in systemd?
Comment by Daniel Wallace (gtmanfred) - Friday, 07 September 2012, 22:07 GMT
sure, make your own .service unit that does what you want, but make the type oneshot and RemainOnExit=yes, and include the ExecStart commands for how what that function does, and ExecStop commands for whatever is needed to reverse them

Loading...