On Sat, 11 Oct 2014 13:38:05 +0300 Andrei POPESCU <andreimpope...@gmail.com> wrote:
> On Vi, 10 oct 14, 19:51:50, Erwan David wrote: > > I want to have a system which boots, and starts a subset of daemons. > > > > Then afterward I ssh to it, do something which 1) mount an encrypted > > disk, 2) start other daemons (which depends on the encrypted disk). > > > > I know how to do this with policy-rc.d, how can I do this with > > systemd ? > > My first though on doing this with sysv-rc would have been runlevels, > why do you even need policy-rc.d? LOL, when I read the original question, I didn't answer because I thought he was inisting on a policy-rc solution. If policy-rc.d weren't required, and if it were me, the solution would be totally obvious, because I'm a daemontools type of guy... I'd put all the services to be started secondarily under daemontools. I'd have a directory somewhere, with empty filenames corresponding to the services I want to bring up secondarily: /home/slitt/servicelist or whatever. Then I'd make these shellscripts: ######################################### #!/bin/sh # this is uppp.sh if bring_up_encrypted_filesystem.sh; then for f in /home/slitt/servicelist; do rm -f /service/$f/down svc -u /service/$f done else handle_encrypt_up_error.sh fi ######################################### ######################################### #!/bin/sh # this is downnn.sh for f in /home/slitt/servicelist; do touch /service/$f/down svc -d /service/$f done if bring_down_encrypted_filesystem.sh; then poweroff else handle_encrypt_down_error.sh fi ######################################### Obviously I haven't tech-edited these, and also obvious I left a lot of stuff for the encrypted disk as an exercise for the reader, but basically: To boot up, you boot up, ssh in, and run uppp.sh To shut down, you ssh in, run downnn.sh. If you sometimes need to reboot instead of powering off, you could remove the shutdown from downnn.sh and just do it manually while you're ssh'ed in. HTH, SteveT Steve Litt * http://www.troubleshooters.com/ Troubleshooting Training * Human Performance -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20141011124548.15d40...@mydesq2.domain.cxm