[opensuse] arcane sysd syntax question: why do some services have '@' in their name?
I was looking over the services in my sysd dir, and notice that some of them end with an '@' sign for no _apparent_ reason: sys/arpwatch@.service* sys/mdmon@.service sys/kmsconvt@.service sys/openvpn@.service sys/mdadm-grow-continue@.service sys/teamd@.service sys/mdadm-last-resort@.service sys/vpnc@.service sys/mdadm-last-resort@.timer sys/wacom-inputattach@.service I currently have 122 service entries, with 9 services using '@', and 2 timers w/1 ending in @. Anyone know why '@' is part of the name, or why it is even considered "a good thing" to include '@' as part of a service name (that isn't a "service@location")? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Отправлено с iPhone
3 марта 2016 г., в 7:56, Linda Walsh <suse@tlinx.org> написал(а):
I was looking over the services in my sysd dir, and notice that some of them end with an '@' sign for no _apparent_ reason:
sys/arpwatch@.service* sys/mdmon@.service sys/kmsconvt@.service sys/openvpn@.service sys/mdadm-grow-continue@.service sys/teamd@.service sys/mdadm-last-resort@.service sys/vpnc@.service sys/mdadm-last-resort@.timer sys/wacom-inputattach@.service
I currently have 122 service entries, with 9 services using '@', and 2 timers w/1 ending in @.
Anyone know why '@' is part of the name, or why it is even considered "a good thing" to include '@' as part of a service name (that isn't a "service@location")?
Those are unit templates, see "man systemd.unit"
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Andrei Borzenkov wrote:
Отправлено с iPhone
3 марта 2016 г., в 7:56, Linda Walsh <suse@tlinx.org> написал(а):
I was looking over the services in my sysd dir, and notice that some of them end with an '@' sign for no _apparent_ reason:
sys/arpwatch@.service* sys/mdmon@.service sys/kmsconvt@.service sys/openvpn@.service sys/mdadm-grow-continue@.service sys/teamd@.service sys/mdadm-last-resort@.service sys/vpnc@.service sys/mdadm-last-resort@.timer sys/wacom-inputattach@.service
I currently have 122 service entries, with 9 services using '@', and 2 timers w/1 ending in @.
Anyone know why '@' is part of the name, or why it is even considered "a good thing" to include '@' as part of a service name (that isn't a "service@location")?
Those are unit templates, see "man systemd.unit"
I.e. they need an instance name. I've only had reason to run one vpn, so that's openvpn@openvpn, but I frequently run multiple postfix instances - postfix@inst1, postfix@inst2 etc. etc. -- Per Jessen, Zürich (1.2°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Per Jessen wrote:
I.e. they need an instance name. I've only had reason to run one vpn, so that's openvpn@openvpn, but I frequently run multiple postfix instances - postfix@inst1, postfix@inst2 etc. etc.
Reminds me of my transmission SysV startup scripts, though they had to be separate files /etc/rc.d/transmission & /etc/rc.d/transmission1 due to lack of params that could be passed to the sysV config system (the comments the beginning of the scripts). Basically the provides line -- in one said transmission, in the other transmission1. -- no way to parameterize that for chkconfig & friends, so separate files just for the 1 line. Everything else was based off the instance, but maybe I can steal some ideas from sysd and eventually condense that. Right now working (s.l.o.w.l.y) on a perl script that reads in the sysd config (that part works) -- including parsing and finding all of the types of files in /etc/sysconfig/system and reading in all of the configs for each file (already had a RC/Win-ini config parser w/variable substitution, So could handle primitive rc files including ones that could handle different instances, like this program that talks to both the transmission instances but could define multiple instances w/combo of same and diff args by specifying a [list] of client names after a [clients] section, like: ## .tor_mgrrc [trackers] default='blahka' [blahka] subdom='tracker' dom='blahka.com' port=2710 path="55555555555555555555555555555555/announce.php" [clients] default='trm' list='trm trm1' [trm] addr='localhost:1024' [trm1] addr='localhost:1025' Basically if it found a section followed by a default keyword, it knew it had a multi-instance service. Another rc file (same handler) read:
more .snapperrc [/home] #excludes=space separated list of patterns to exclude #additive string excludes='.recycle/** Bliss/law Bliss/law.V2/** Bliss/athenae/** Bliss/root**' excludes="$excludes CPAN-ishtar-build-cache/**" excludes="$excludes .snapdir/**" excludes="$excludes /home/law/dup-tst-dir/** /home/law/font/[1-8]"
# age = age of snap in integer days w/midnight as cutoff expire='age>32 or' expire="$expire age>24 && day_of_year%8 or" expire="$expire age>16 && day_of_year%4 or" expire="$expire age>8 && day_of_year%2" expire_default='lx' ## list only snap_needed='age>1 or' snap_needed="$snap_needed hour_age>8" and passed the excludes and expires and snap_needed as config options to a program. ---- Basically tried to read rc files in "by section" with everything in a top section, so keys&values are stored by section just like in a Win-ini file. I designed it pre-sysd, but remembered how it worked and it pretty much worked the first time in reading in sysd files & dirs -- if it encountered a file, it called the read-config routine, which automatically read in each key/value by section. Haven't gone beyond reading it in (no validation of config files), but it does validate the tree and filename structures so I can list my sysd stuff by types or by object-names. Ideally will be able to convert chkconfig and friends to use the data-access routines to automatically start services from /etc/rc.d/ or from the sysd config dir so no messages of sysd shadowing sysV files-- will use whatever is there, providing ongoing cross compatibility -- not the easiest nor most exciting tasks, but ultimately the most flexible... The easiest compat solution might just be to run the sysd-db-read routine after any service change and it will recreate a sysV script and ordering to go in /etc/{init,rc}.d I figure if my script can handle dynamic creation of sysV scripts on the fly from sysd scripts, that might be easiest solution. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 03/02/2016 11:56 PM, Linda Walsh wrote:
I was looking over the services in my sysd dir, and notice that some of them end with an '@' sign for no _apparent_ reason:
sys/arpwatch@.service* sys/mdmon@.service sys/kmsconvt@.service sys/openvpn@.service sys/mdadm-grow-continue@.service sys/teamd@.service sys/mdadm-last-resort@.service sys/vpnc@.service sys/mdadm-last-resort@.timer sys/wacom-inputattach@.service
I currently have 122 service entries, with 9 services using '@', and 2 timers w/1 ending in @.
I don't have those. What package do the come with?
Anyone know why '@' is part of the name, or why it is even considered "a good thing" to include '@' as part of a service name (that isn't a "service@location")?
These are not actual service units, they are templates for the generator to work with. The most common example is the getty@.service, though I've made use of the vpn@.servcie as well. If you trace though the active /etc/systemd/system/getty.target.wants You will find and instantiation such as getty@tty1.service The clue that this is built from a template is the line Description=Getty on %I And then there is Documentation=man:agetty(8) man:systemd-getty-generator(8) Documentation=http://0pointer.de/blog/projects/serial-console.html SYSTEMD-GETTY-GENERATOR(8) goes on the explain that it instantiates the actual instance of the getty. The cool thing about this is that the service getty@tty2.service though getty@tty6.service don't actually exist until you hotkey and use those VT! Pretty neat, eh? It use to be that to use a openVPN I had to set up an entry for it in in the Xinetd.conf file and that was just one instance. I had to create more instances for additional VPNs. YMMV. Under systemd this is done with a template and instantiation just like with ttys. <quote src="https://fedoraproject.org/wiki/Openvpn#Working_with_systemd"> With the transition to systemd, OpenVPN no longer has a single monolithic init script, where every connection with a configuration file in /etc/openvpn/ is started automatically. Instead, individual connections can be started and stopped with systemctl. </quote> Hey, that means I can set up arbitrary links like I do with SSH! The most obvious use of templates is to start up FSCK as needed. See man systemd-fsck@.service Its wonderful what you can find if you RTFM. I've learnt something about systemd and instantiation and use of systemctl while researching this post :-) I'm not a systemd guru by any means, just curious and open minded and think that if I have to live with systemd I better not fight and and bitch and complain but rather learn a little more each day. Thank you, Linda, for prompting me to look further into this :-) -- A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting frowned upon? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Anton Aylward wrote:
On 03/02/2016 11:56 PM, Linda Walsh wrote:
I was looking over the services in my sysd dir, and notice that some of them end with an '@' sign for no _apparent_ reason:
sys/arpwatch@.service* sys/mdmon@.service sys/kmsconvt@.service sys/openvpn@.service sys/mdadm-grow-continue@.service sys/teamd@.service sys/mdadm-last-resort@.service sys/vpnc@.service sys/mdadm-last-resort@.timer sys/wacom-inputattach@.service
I currently have 122 service entries, with 9 services using '@', and 2 timers w/1 ending in @.
I don't have those. What package do the come with?
rpm -e mdadm-3.3.1-5.3.1.x86_64 error: Failed dependencies: mdadm >= 3.3 is needed by (installed) libstorage5-2.25.18-3.1.x86_64 rpm -e libstorage5 error: Failed dependencies:
-- ran the attached script in the relevant dir, which is really a symlink: Ishtar:law/bin/sys/sys> /bin/pwd /usr/lib/systemd/system Ishtar:law/bin/sys/sys> /tmp/rpm_n_dist Dist Path Rpm ---- ---- --- 13.2, arpwatch@.service, arpwatch-2.1a15-157.1.3.x86_64 13.2, kmsconvt@.service, kmscon-8-2.1.4.x86_64 13.2, mdadm-grow-continue@.service, mdadm-3.3.1-5.3.1.x86_64 13.2, mdadm-last-resort@.service, mdadm-3.3.1-5.3.1.x86_64 13.2, mdadm-last-resort@.timer, mdadm-3.3.1-5.3.1.x86_64 13.2, mdmon@.service, mdadm-3.3.1-5.3.1.x86_64 13.2, openvpn@.service, openvpn-2.3.4-2.7.1.x86_64 13.2, teamd@.service, libteam-tools-1.11-2.1.4.x86_64 13.2, vpnc@.service, vpnc-0.5.3r517-9.2.1.x86_64 13.2, wacom-inputattach@.service, xf86-input-wacom-0.24.0-2.1.4.x86_64 --- Am mildly surprised you don't have any of those installed -- since some seem to be required for a working system, like: libstorage.so.5()(64bit) is needed by (installed) libstorage-ruby-2.25.18-3.1.x86_64 libstorage.so.5()(64bit) is needed by (installed) yast2-storage-3.1.50-4.1.x86_64 libstorage5 = 2.25.18 is needed by (installed) libstorage-ruby-2.25.18-3.1.x86_64 libstorage5 >= 2.25.18 is needed by (installed) yast2-storage-3.1.50-4.1.x86_64
rpm -e yast2-storage error: Failed dependencies: yast2-storage >= 2.21.11 is needed by (installed) yast2-network-3.1.104-1.3.x86_64 yast2-storage is needed by (installed) yast2-reipl-3.1.4-2.1.9.noarch yast2-storage >= 2.16.1 is needed by (installed) yast2-add-on-3.1.9-1.9.noarch yast2-storage is needed by (installed) yast2-live-installer-3.1.3-2.1.10.noarch yast2-storage is needed by (installed) autoyast2-installation-3.1.66-1.1.noarch yast2-storage >= 2.24.1 is needed by (installed) yast2-installation-3.1.116-1.6.noarch yast2-storage >= 2.22.9 is needed by (installed) yast2-update-3.1.23-1.7.x86_64 yast2-storage >= 2.18.18 is needed by (installed) yast2-bootloader-3.1.101a-5.1.x86_64 yast2-storage is needed by (installed) yast2-kdump-3.1.19-1.8.x86_64
---- What type of system are you running on that doesn't use yast? The others have similarly long nested lists of requirements -- I don't see how you could have a 13.2 installed and not have any of those -- nor do I find it likely all of those dependencies would be disappearing in Leap... Are you sure your system is "integrous" ? ;-) impossible #!/bin/bash -u shopt -s expand_aliases alias my=declare int=my\ -i sub=function declare base=$(/bin/pwd) readarray -t pathnames< <('ls' -1 *@.*) readarray -t rpms< <(for p in "${pathnames[@]}";do rpm -qf "$base/$p"; done) readarray -t dist< <(for r in "${rpms[@]}"; do rpm -qi "$r"|grep Dist|print_field_n 3; done) sub max_len () { my ar_p="$1" ; shift int max=0 my p="" for p in $(eval "echo \"\${$ar_p[@]}\""); do ((${#p}>$max)) && max=${#p} done echo $max } int dml=1+$(max_len dist) int pml=1+$(max_len pathnames) int rml=$(max_len rpms) int i=0 printf "%-*s %-*s %s\n" "$dml" Dist "$pml" Path Rpm printf "%-*s %-*s %s\n" "$dml" ---- "$pml" ---- --- for ((i=0;i<${#pathnames[@]};++i)) do printf "%-*s %-*s %s\n" "$dml" "${dist[i]}," \ "$pml" "${pathnames[i]}," "${rpms[i]}" done
participants (4)
-
Andrei Borzenkov
-
Anton Aylward
-
Linda Walsh
-
Per Jessen