https://wiki.archlinux.org/api.php?action=feedcontributions&user=Asvil&feedformat=atom
ArchWiki - User contributions [en]
2024-03-28T13:35:43Z
User contributions
MediaWiki 1.41.0
https://wiki.archlinux.org/index.php?title=Systemd/Services&diff=245043
Systemd/Services
2013-01-25T11:01:32Z
<p>Asvil: start emacs daemon in user dir</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Daemons and system services]]<br />
[[Category:Boot process]]<br />
{{Article summary start}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|systemd}}<br />
{{Article summary end}}<br />
<br />
This page is useful to publish [[systemd]] service files that are missing in the appropriate package in the repositories. These files can be copied from other distributions or created by yourself.<br />
<br />
== Adsuck ==<br />
{{hc|/etc/systemd/system/adsuck.service|<nowiki><br />
[Unit]<br />
Description=Adsuck daemon<br />
After=network.target<br />
<br />
[Service]<br />
Type=forking<br />
ExecStart=/usr/sbin/adsuck -l 127.0.0.1 -c /var/adsuck -f /resolv.conf /hosts -r /filter<br />
ExecStartPost=/bin/sh -c "echo 'nameserver 127.0.0.1' > /etc/resolv.conf"<br />
ExecStop=/bin/kill $MAINPID<br />
ExecStopPost=/bin/sh -c "cp /var/adsuck/resolv.conf /etc/resolv.conf"<br />
ExecReload=/bin/kill -HUP $MAINPID ; /bin/kill -USR1 $MAINPID<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{Note|1=Script based on the comment on the {{AUR|adsuck}} [[AUR]] package page.}}<br />
<br />
== BOINC Daemon ==<br />
{{hc|/etc/systemd/system/boinc.service|<nowiki><br />
[Unit]<br />
Description=BOINC Daemon<br />
<br />
[Service]<br />
User=boinc<br />
Nice=19<br />
ExecStart=/usr/bin/boinc_client --dir /var/lib/boinc --redirectio<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
== Change name of wireless interface ==<br />
<br />
For those rare occasions where this is necessary.<br />
{{hc|/etc/iftab|<nowiki><br />
wlan* mac [mac-address]</nowiki>}}<br />
Replace [mac-address] with the one corresponding to the networking hardware.<br />
<br />
{{hc|/etc/systemd/system/fix-wireless-interface.service|<nowiki><br />
[Unit]<br />
Description=Changes the wireless interface eth1 to the proper wlan*<br />
Wants=network.target<br />
Before=network.target<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/sbin/ifrename -c /etc/iftab<br />
<br />
[Install]<br />
WantedBy=multi-user.target</nowiki>}}<br />
<br />
== Courier-IMAP ==<br />
{{hc|/etc/systemd/system/authdaemond.service|<nowiki><br />
[Unit]<br />
Description=Courier Authentification Daemon<br />
<br />
[Service]<br />
Type=forking<br />
ExecStart=/usr/sbin/authdaemond start<br />
ExecStop=/usr/sbin/authdaemon stop<br />
PIDFile=/run/authdaemon/pid<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{hc|/etc/systemd/system/courier-imapd.service|<nowiki><br />
[Unit]<br />
Description=Courier IMAP Daemon<br />
Requires=authdaemond.service<br />
After=authdaemond.service<br />
<br />
[Service]<br />
Type=forking<br />
EnvironmentFile=/etc/courier-imap/imapd<br />
ExecStart=/usr/lib/courier-imap/imapd.rc start<br />
ExecStop=/usr/lib/courier-imap/imapd.rc stop<br />
PIDFile=/var/run/courier/imapd.pid<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{hc|/etc/systemd/system/courier-imapd-ssl.service|<nowiki><br />
[Unit]<br />
Description=Courier IMAP Daemon<br />
Requires=authdaemond.service<br />
After=authdaemond.service<br />
<br />
[Service]<br />
Type=forking<br />
EnvironmentFile=/etc/courier-imap/imapd<br />
ExecStart=/usr/lib/courier-imap/imapd-ssl.rc start<br />
ExecStop=/usr/lib/courier-imap/imapd-ssl.rc stop<br />
PIDFile=/var/run/courier/imapd-ssl.pid<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{hc|/usr/lib/tmpfiles.d/authdaemond.conf|<nowiki><br />
D /run/authdaemon 0755 courier courier<br />
</nowiki>}}<br />
<br />
{{hc|/usr/lib/tmpfiles.d/courier-imapd.conf|<nowiki><br />
D /run/courier 0755 courier courier<br />
</nowiki>}}<br />
<br />
{{Note|Taken from Gentoo and modified for Arch. You could replace the files in tmpfiles.d with appropriate ExecStartPre calls as well. Service files for pop3d and pop3d-ssl are still missing, but are probably very similar to the imapd files!}}<br />
<br />
{{Warning|1=Beware that you may need to add Requires=network.target to certain units like mythtv or chrony if you use this unit }}<br />
<br />
== dropbear ==<br />
{{hc|/etc/systemd/system/dropbear.service|<br />
<nowiki><br />
[Unit]<br />
Description=Dropbear SSH server<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/sbin/dropbear -p 22 -d /etc/dropbear/dropbear_dss_host_key -w -P /var/run/dropbear.pid<br />
RemainAfterExit=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
</nowiki>}}<br />
<br />
== IPv6 (Hurricane Electric) ==<br />
{{hc|/etc/systemd/system/he-ipv6.service|<nowiki><br />
<br />
[Unit]<br />
Description=he.net IPv6 tunnel<br />
After=network.target<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
ExecStart=/sbin/ip tunnel add he-ipv6 mode sit remote 209.51.161.14 local <local IPv4> ttl 255<br />
ExecStart=/sbin/ip link set he-ipv6 up mtu 1480<br />
ExecStart=/sbin/ip addr add <local IPv6>/64 dev he-ipv6<br />
ExecStart=/sbin/ip -6 route add ::/0 dev he-ipv6<br />
ExecStart=/sbin/ip addr add <public IPv6>/64 dev he-ipv6<br />
ExecStop=/sbin/ip -6 route del ::/0 dev he-ipv6<br />
ExecStop=/sbin/ip link set he-ipv6 down<br />
ExecStop=/sbin/ip tunnel del he-ipv6<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
</nowiki>}}<br />
<br />
== Logmein Hamachi ==<br />
{{hc|/etc/systemd/system/hamachi.service|<nowiki><br />
[Unit]<br />
Description=Hamachi Daemon<br />
After=network.target<br />
<br />
[Service]<br />
Type=forking<br />
ExecStart=/opt/logmein-hamachi/bin/hamachid<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
== pcscd ==<br />
{{hc|/etc/systemd/system/pcscd.service|<nowiki><br />
[Unit]<br />
Description=PC/SC Smart Card Daemon<br />
Requires=pcscd.socket<br />
<br />
[Service]<br />
ExecStart=/usr/sbin/pcscd --foreground --auto-exit<br />
ExecReload=/usr/sbin/pcscd --hotplug<br />
StandardOutput=syslog<br />
<br />
[Install]<br />
Also=pcscd.socket<br />
</nowiki>}}<br />
<br />
{{hc|/etc/systemd/system/pcscd.socket|<nowiki><br />
[Unit]<br />
Description=PC/SC Smart Card Daemon Activation Socket<br />
<br />
[Socket]<br />
ListenStream=/var/run/pcscd/pcscd.comm<br />
<br />
[Install]<br />
WantedBy=sockets.target<br />
</nowiki>}}<br />
Reference:<br />
* http://ludovicrousseau.blogspot.de/2011/11/pcscd-auto-start-using-systemd.html<br />
<br />
== Filesystem mounts ==<br />
''See: [[Systemd#Filesystem_mounts]]''<br />
<br />
== screen ==<br />
Autostarts screen for the specified user. (e.g. `systemctl enable screen@florian.service`)<br />
{{hc|/etc/systemd/system/screen@.service|<nowiki><br />
[Unit]<br />
Description=screen<br />
After=network.target<br />
<br />
[Service]<br />
Type=forking<br />
User=%i<br />
ExecStart=/usr/bin/screen -dmS autoscreen<br />
ExecStop=/usr/bin/screen -S autoscreen -X quit<br />
<br />
[Install]<br />
WantedBy=multi-user.target</nowiki>}}<br />
<br />
== Static Ethernet network ==<br />
<br />
This is a custom service file for static Ethernet configurations. For other configurations, see [[Systemd#Network]]<br />
{{Warning |1=Beware, you may have to add 'Requires=network.target' for certain services like chrony or mythtv when using this.}}<br />
{{hc|/etc/conf.d/network|<nowiki><br />
interface=eth0<br />
address=192.168.0.1<br />
netmask=24<br />
broadcast=192.168.0.255<br />
gateway=192.168.0.254</nowiki>}}<br />
<br />
{{hc|/etc/systemd/system/network.service|<nowiki><br />
[Unit]<br />
Description=Network Connectivity<br />
Wants=network.target<br />
Before=network.target<br />
<br />
[Service]<br />
Type=oneshot<br />
RemainAfterExit=yes<br />
EnvironmentFile=/etc/conf.d/network<br />
ExecStart=/sbin/ip link set dev ${interface} up<br />
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}<br />
ExecStart=/sbin/ip route add default via ${gateway}<br />
<br />
ExecStop=/sbin/ip addr flush dev ${interface}<br />
ExecStop=/sbin/ip link set dev ${interface} down<br />
<br />
[Install]<br />
WantedBy=multi-user.target</nowiki>}}<br />
<br />
== Set network interface in promiscuous mode ==<br />
{{hc|/etc/systemd/system/promiscuous@.service|<nowiki><br />
[Unit]<br />
Description=Set %i interface in promiscuous mode<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/sbin/ip link set dev %i promisc on<br />
RemainAfterExit=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
If you want to enable promiscuous mode on interface {{ic|1=eth0}} run:<br />
<br />
# systemctl enable promiscuous@eth0.service<br />
<br />
==tmux==<br />
Starts screen for specified user (eg. tmux@main-user.service)<br />
{{hc|/etc/systemd/system/tmux@.service|<nowiki><br />
[Unit]<br />
Description=Start tmux in detached session<br />
<br />
[Service]<br />
Type=forking<br />
ExecStart=/usr/bin/tmux new-session -s %u -d<br />
ExecStop=/usr/bin/tmux kill-session -t %u<br />
User=%I<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
== tpfand ==<br />
{{hc|/etc/systemd/system/tpfand.service|<nowiki><br />
[Unit]<br />
Description=ThinkPad Fan Control<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/var/run/tpfand.pid<br />
ExecStart=/usr/sbin/tpfand<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
== truecrypt volume setup==<br />
This service employ truecrypt as a mapper only and requires you to create an entry in fstab to mount the mapped & unencrypted device to your desired mountpoint like for instance so:<br />
{{hc|/etc/fstab|<nowiki><br />
/dev/mapper/truecrypt1 /home/ ext4 defaults 0 2</nowiki>}}<br />
<br />
The {{ic|2}} means your fs will be fscked regularly.<br />
<br />
{{hc|/usr/lib/systemd/system/truecrypt@.service|<nowiki><br />
[Unit]<br />
Description=Truecrypt Setup for %I<br />
DefaultDependencies=no<br />
Conflicts=umount.target<br />
Before=umount.target<br />
After=systemd-readahead-collect.service systemd-readahead-replay.service<br />
<br />
[Service]<br />
RemainAfterExit=yes<br />
StandardInput=tty-force<br />
ExecStart=/usr/bin/truecrypt --filesystem=none %I<br />
ExecStop=/usr/bin/truecrypt --filesystem=none -d %I<br />
<br />
[Install]<br />
WantedBy=cryptsetup.target</nowiki>}}<br />
<br />
If your encrypted volume is {{ic|1=/dev/sda2}}, you would enable the service with this command: <br />
# systemctl enable truecrypt@dev-sda2.service<br />
<br />
{{Note|1=Although it works, this service should stil be considered experimental, there might be better solutions to use truecrypt with systemd. If you use mpd or any other programme that needs to access the encrypted filesystem, put it into the line starting with {{ic|1=Before=}}. Cheers to dgbaley27 for basically writing this! Improvements welcome!}}<br />
<br />
{{Note|This way of doing it (specifically the use of tty-force) is not recommended according to [http://lists.freedesktop.org/archives/systemd-devel/2012-October/006905.html this thread], which suggests an alternative approach similar to that taken for LUKS.}}<br />
<br />
== truecrypt (mount encrypted fs) ==<br />
{{hc|/etc/systemd/system/multi-user.target/truecrypt-mount.service|<nowiki><br />
[Unit]<br />
Description=Mount Truecrypt-encrypted filesystems<br />
ConditionFileIsExecutable=/usr/bin/truecrypt<br />
#Requires=truecrypt-unmount.service<br />
#Before=mpd.service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/truecrypt -t /dev/sdXY /MOUNTPOINT<br />
StandardInput=tty-force<br />
RemainAfterExit=yes<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
#Also=truecrypt-unmount.service<br />
</nowiki>}}<br />
<br />
{{Note|1=Gleaned from [https://bbs.archlinux.org/viewtopic.php?pid=1163760#p1163760 bpont on the forums]. If you use mpd and have your music dir in ~, uncomment {{ic|1=Before=mpd.service}}, which takes care that mpd is started after this script. If you also use {{ic|1=truecrypt-unmount.service}} (see next service) uncomment the {{ic|1=Requires=truecrypt-unmount.service}} and {{ic|1=Also=truecrypt-unmount.service}} so it gets installed and activated by systemd automatically when using this script.}}<br />
<br />
== truecrypt (unmount encrypted fs) ==<br />
{{hc|/etc/systemd/system/multi-user/truecrypt-unmount.service|<nowiki><br />
[Unit]<br />
Description=Truecrypt unmount on shutdown, poweroff, reboot, system halt<br />
Before=local-fs-pre.target<br />
#Before=mpd.service<br />
ConditionPathExistsGlob=/media/truecrypt*<br />
DefaultDependencies=no<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/truecrypt -d<br />
TimeoutSec=5<br />
StandardInput=tty<br />
<br />
[Install]<br />
WantedBy=shutdown.target reboot.target halt.target poweroff.target<br />
</nowiki>}}<br />
<br />
{{Note|1=I don't know if this works yet. It may be necessary to replace {{ic|1=TimeoutSec=5}} with {{ic|1=ExecStart=sleep 5}}. If you use {{ic|mpd}}, make sure to uncomment {{ic|1=Before=mpd.service}} to make sure this service is executed after mpd is closed down (different order during the shutdown of processes than during start up!). Script gleaned from [https://bbs.archlinux.org/viewtopic.php?pid=1163334#p1163334 tladuke on the forums].}}<br />
<br />
== verynice ==<br />
{{hc|/etc/systemd/system/verynice.service|<nowiki><br />
[Unit]<br />
Description=A tool for dynamically adjusting the nice-level of processes<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/var/run/verynice.pid<br />
ExecStart=/usr/sbin/verynice -d /var/run/verynice.pid<br />
ExecStop=/bin/kill -15 $MAINPID<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
== MPD Socket Activation ==<br />
If the following mpd.socket file is enabled while mpd.service (provided by {{Pkg|mpd}}) is disabled, systemd will not start mpd immediately, but it will listen on the appropriate sockets. When an mpd client attempts to connect on one of those sockets, systemd will start mpd.service and transparently hand over control of those ports to the mpd process.<br />
<br />
If you prefer to listen on different UNIX sockets or network ports (even multiple sockets of each type), or if you prefer not to listen on network ports at all, you should add/edit/remove the appropriate "ListenStream=" lines in the [Socket] section of mpd.socket ''AND'' modify the appropriate lines /etc/mpd.conf (see "man 5 mpd.conf" for more details).<br />
<br />
If you use different (even multiple) network or local sockets, or prefer not to use network sockets at all, simply add, change, or remove lines beginning with "ListenStream=" in the [Socket] section.<br />
{{hc|/usr/lib/systemd/system/mpd.socket|<nowiki><br />
[Unit]<br />
Description=Music Player Daemon Sockets<br />
<br />
[Socket]<br />
ListenStream=/var/run/mpd/socket<br />
ListenStream=6600<br />
<br />
[Install]<br />
WantedBy=sockets.target<br />
</nowiki>}}<br />
<br />
== VideoLAN 2.0 ==<br />
Change the '''User''' parameter.<br />
<br />
{{hc|/etc/systemd/system/vlc.service|<nowiki><br />
[Unit]<br />
Description=VideoOnLAN Service<br />
After=network.target<br />
<br />
[Service]<br />
Type=forking<br />
User=nobody<br />
ExecStart=/usr/bin/cvlc --intf=lua --lua-intf=http --daemon --http-port 8090<br />
Restart=on-abort<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
== Xvfb ==<br />
Change the '''User'''/'''Group''' parameters.<br />
{{hc|/etc/systemd/system/xinit.service|<nowiki><br />
[Unit]<br />
Description=xinit with xvfb<br />
After=network.target<br />
<br />
[Service]<br />
User=bitlbee<br />
Group=bitlbee<br />
ExecStart=/usr/bin/xvfb-run bash %h/.xinitrc<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
== ZNC ==<br />
Assuming znc was set up to be run by znc user from {{ic|/var/lib/znc}} as explained in the [[Znc]] wiki page.<br />
<br />
{{hc|/etc/systemd/system/znc.service|<nowiki><br />
[Unit]<br />
Description=ZNC Daemon<br />
After=network.target<br />
<br />
[Service]<br />
ExecStart=/usr/bin/znc -f -d /var/lib/znc<br />
User=znc<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
<br />
</nowiki>}}<br />
<br />
== Nexus ==<br />
This is for Sonatype's Nexus OSS Artifact Repository.<br />
{{AUR|nexus2}} is in the [[AUR]].<br />
<br />
{{hc|/etc/systemd/system/nexus.service|<nowiki><br />
[Unit]<br />
Description=Nexus OSS Artifact Repository<br />
<br />
[Service]<br />
Type=forking<br />
EnvironmentFile=-/etc/conf.d/nexus<br />
ExecStart=/opt/nexus/bin/nexus start<br />
ExecStop=/opt/nexus/bin/nexus stop<br />
ExecReload=/opt/nexus/bin/nexus restart<br />
PIDFile=/opt/nexus/run/nexus.pid<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
== Gitlab ==<br />
<br />
{{hc|/etc/systemd/system/gitlab.service|<nowiki><br />
[Unit]<br />
Description=Self Hosted Git Management<br />
Requires=postgresql.service redis.service<br />
After=postgresql.service redis.service<br />
Wants=postfix.service gitlab-worker.service<br />
<br />
[Service]<br />
Type=forking<br />
User=gitlab<br />
WorkingDirectory=/home/gitlab/gitlab<br />
ExecStart=/home/gitlab/gitlab/script/rails server -d -e production<br />
PIDFile=/home/gitlab/gitlab/tmp/pids/server.pid<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{hc|/etc/systemd/system/gitlab-worker.service|<nowiki><br />
[Unit]<br />
Description=Gitlab Resque Worker<br />
Requires=redis.service<br />
After=redis.service<br />
Wants=postfix.service postgresql.service<br />
<br />
[Service]<br />
Type=forking<br />
User=gitlab<br />
WorkingDirectory=/home/gitlab/gitlab<br />
ExecStart=/bin/bash -c '. ~/.bashrc; . ./resque.sh'<br />
ExecStopPost=/usr/bin/rm /home/gitlab/gitlab/tmp/pids/resque_worker.pid<br />
PIDFile=/home/gitlab/gitlab/tmp/pids/resque_worker.pid<br />
</nowiki>}}<br />
<br />
== Cisco AnyConnect VPN ==<br />
<br />
{{hc|/etc/systemd/system/ciscovpn.service|<nowiki><br />
[Unit]<br />
Description=Cisco AnyConnect Secure Mobility Client Agent<br />
Requires=network.target remote-fs.target<br />
After=network.target remote-fs.target<br />
<br />
[Service]<br />
Type=forking<br />
PIDFile=/var/run/vpnagentd.pid<br />
ExecStart=/opt/cisco/anyconnect/bin/vpnagentd<br />
ExecStop=/usr/bin/killall /opt/cisco/anyconnect/bin/vpnagentd<br />
Restart=on-abort<br />
<br />
[Install]<br />
# one may want to use multi-user.target instead<br />
WantedBy=graphical.target<br />
</nowiki>}}<br />
<br />
== Emacs Daemon ==<br />
{{hc|/etc/systemd/system/emacs@.service|<nowiki><br />
[Unit]<br />
Description=Emacs: the extensible, self-documenting text editor<br />
<br />
[Service]<br />
Type=forking<br />
ExecStart=/usr/bin/emacs --daemon --chdir %h<br />
ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook 'nil) (kill-emacs))"<br />
Restart=always<br />
User=%i<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{Note|1= Enable the unit for your user<br />
systemctl enable emacs@<username><br />
systemctl start emacs@<username>}}<br />
{{Note|1=Source: [http://www.emacswiki.org/emacs/EmacsAsDaemon#toc8 EmacsWiki].}}<br />
<br />
== Monkey http server deamon ==<br />
{{hc|/etc/systemd/system/monkey.service|<nowiki><br />
[Unit]<br />
Description=Monkey http server deamon<br />
After=network.target<br />
<br />
[Service]<br />
Type=forking<br />
ExecStart=/YOUR/PATH/TO/monkey/bin/monkey -D<br />
ExecStop=/bin/kill $MAINPID<br />
ExecReload=/bin/kill $MAINPID ; /YOUR/PATH/TO/monkey/bin/monkey -D<br />
PIDFile=/YOUR/PATH/TO/monkey/monkey.pid.80<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{Note|1= Replace /YOUR/PATH/TO entries with the path to monkey on your system}}<br />
{{Note|1= PIDFile= entry should point to pidfile location specified in your monkey config file. The configured port number should be appended to the filename}}<br />
{{Note|1=Gist available at: [git://gist.github.com/4238052.git github].}}<br />
<br />
== VirtualBox virtual machines ==<br />
<br />
{{hc|/etc/systemd/system/vboxvmservice@.service|<nowiki><br />
[Unit]<br />
Description=VBox Virtual Machine %i Service<br />
Requires=systemd-modules-load.service<br />
After=systemd-modules-load.service<br />
<br />
[Service]<br />
User=user<br />
Group=vboxusers<br />
ExecStart=/usr/bin/VBoxHeadless -s %i<br />
ExecStop=/usr/bin/VBoxManage controlvm %i savestate<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{Note|1= Each virtual machine has its own service. Replace user with a user that is a member of the vboxusers group.<br />
systemctl enable vboxvmservice@<vm name>.service<br />
systemctl start vboxvmservice@<vm name>.service}}<br />
{{Note|1=As of VirtualBox 4.2 there is another way to get virtual machines going: http://lifeofageekadmin.com/how-to-set-your-virtualbox-vm-to-automatically-startup/ Please edit the [[VirtualBox]] page if you figure it out.}}<br />
<br />
<br />
== See also ==<br />
<br />
* [[systemd]]<br />
* [http://en.gentoo-wiki.com/wiki/Systemd systemd at gentoo wiki]</div>
Asvil