Systemd configuration to wait for mount of SS filesystem
We use a site specific systemd unit which we call gpfs_fs.service that `BindsTo=gpfs.service` and `After=gpfs.service`. This service basically waits for GPFS to become active and then once active attempts to mount the required file systems. The list of file systems is determined by our own system configuration software (e.g. puppet/cfengine/salt-stack/ansible). We have also added a custom extension to gpfs.service (/usr/lib/systemd/system/gpfs.service.d/gpfs.service.conf) which adds a ExecStartPre to the IBM provided unit (we don’t want to mess with this IBM provide file). This ExecStartPre will make sure the node has the required version of GPFS installed and do some other basic checks. We have other systemd controlled process then both `BindsTo` and `After` the gpfs_fs.service. This works pretty well for us. Hope that helps, -Bryan From: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> On Behalf Of Frederick Stock Sent: Thursday, March 14, 2019 3:17 PM To: gpfsug-discuss@spectrumscale.org Cc: gpfsug-discuss@spectrumscale.org Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem [EXTERNAL EMAIL] It is not systemd based but you might want to look at the user callback feature in GPFS (mmaddcallback). There is a file system mount callback you could register. Fred __________________________________________________ Fred Stock | IBM Pittsburgh Lab | 720-430-8821 stockf@us.ibm.com<mailto:stockf@us.ibm.com> ----- Original message ----- From: "Stephen R Buchanan" <stephen.buchanan@us.ibm.com<mailto:stephen.buchanan@us.ibm.com>> Sent by: gpfsug-discuss-bounces@spectrumscale.org<mailto:gpfsug-discuss-bounces@spectrumscale.org> To: gpfsug-discuss@spectrumscale.org<mailto:gpfsug-discuss@spectrumscale.org> Cc: Subject: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem Date: Thu, Mar 14, 2019 3:58 PM I searched the list archives with no obvious results. I have an application that runs completely from a Spectrum Scale filesystem that I would like to start automatically on boot, obviously after the SS filesystem mounts, on multiple nodes. There are groups of nodes for dev, test, and production, (separate clusters) and the target filesystems are different between them (and are named differently, so the paths are different), but all nodes have an identical soft link from root (/) that points to the environment-specific path. (see below for details) My first effort before I did any research was to try to simply use a directive of After=gpfs.service which anyone who has tried it will know that the gpfs.service returns as "started" far in advance (and independently of) when filesystems are actually mounted. What I want is to be able to deploy a systemd service-unit and path-unit pair of files (that are as close to identical as possible across the environments) that wait for /appbin/builds/ to be available (/[dev|tst|prd]01/ to be mounted) and then starts the application. The problem is that systemd.path units, specifically the 'PathExists=' directive, don't follow symbolic links, so I would need to customize the path unit file for each environment with the full (real) path. There are other differences between the environments that I believe I can handle by specifying an EnvironmentFile directive -- but that would come from the SS filesystem so as to be a single reference point, so it can't help with the path unit. Any suggestions are welcome and appreciated. dev:(path names have been slightly generalized, but the structure is identical) SS filesystem: /dev01 full path: /dev01/app-bin/user-tree/builds/ soft link: /appbin/ -> /dev01/app-bin/user-tree/ test: SS filesystem: /tst01 full path: /tst01/app-bin/user-tree/builds/ soft link: /appbin/ -> /tst01/app-bin/user-tree/ prod: SS filesystem: /prd01 full path: /prd01/app-bin/user-tree/builds/ soft link: /appbin/ -> /prd01/app-bin/user-tree/ Stephen R. Wall Buchanan Sr. IT Specialist IBM Data & AI North America Government Expert Labs +1 (571) 299-4601 stephen.buchanan@us.ibm.com<mailto:stephen.buchanan@us.ibm.com> _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss<https://nam03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgpfsug.org%2Fmailman%2Flistinfo%2Fgpfsug-discuss&data=02%7C01%7Cbbanister%40jumptrading.com%7C1e6d0217603b45bbe7d708d6a8ba1f79%7C11f2af738873424085a3063ce66fc61c%7C1%7C0%7C636881914702678858&sdata=AKJ3vzG0U4MVDdhOky7cBK6aC0DKmNTqk3y51s4CaeY%3D&reserved=0> ________________________________ Note: This email is for the confidential use of the named addressee(s) only and may contain proprietary, confidential, or privileged information and/or personal data. If you are not the intended recipient, you are hereby notified that any review, dissemination, or copying of this email is strictly prohibited, and requested to notify the sender immediately and destroy this email and any attachments. Email transmission cannot be guaranteed to be secure or error-free. The Company, therefore, does not make any guarantees as to the completeness or accuracy of this email or any attachments. This email is for informational purposes only and does not constitute a recommendation, offer, request, or solicitation of any kind to buy, sell, subscribe, redeem, or perform any type of transaction of a financial product. Personal data, as defined by applicable data privacy laws, contained in this email may be processed by the Company, and any of its affiliated or related companies, for potential ongoing compliance and/or business-related purposes. You may have rights regarding your personal data; for information on exercising these rights or the Company’s treatment of personal data, please email datarequests@jumptrading.com.
K.I.S.S. Try to open and read a file that you stored in GPFS. If good, proceed. Otherwise wait a second and retry. Nope, nothing GPFS specific about that. Need not be privileged or root either. K.I.S.S.
+1 for using callbacks, we use the Mount and preUnMount callbacks on various things, e.g. before unmount, shutdown all the VMs running on the host, i.e. start and stop other things cleanly when the FS arrives/before it goes away. Simon From: <gpfsug-discuss-bounces@spectrumscale.org> on behalf of "stockf@us.ibm.com" <stockf@us.ibm.com> Reply-To: "gpfsug-discuss@spectrumscale.org" <gpfsug-discuss@spectrumscale.org> Date: Thursday, 14 March 2019 at 21:04 To: "gpfsug-discuss@spectrumscale.org" <gpfsug-discuss@spectrumscale.org> Cc: "gpfsug-discuss@spectrumscale.org" <gpfsug-discuss@spectrumscale.org> Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem But if all you are waiting for is the mount to occur the invocation of the callback informs you the file system has been mounted. You would be free to start a command in the background, with appropriate protection, and exit the callback script. Also, making the callback script run asynchronous means GPFS will not wait for it to complete and that greatly mitigates any potential problems with GPFS commands, if you need to run them from the script. Fred __________________________________________________ Fred Stock | IBM Pittsburgh Lab | 720-430-8821 stockf@us.ibm.com ----- Original message ----- From: "Stephen R Buchanan" <stephen.buchanan@us.ibm.com> Sent by: gpfsug-discuss-bounces@spectrumscale.org To: gpfsug-discuss@spectrumscale.org Cc: Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem Date: Thu, Mar 14, 2019 4:52 PM The man page for mmaddcallback specifically cautions against running "commands that involve GPFS files" because it "may cause unexpected and undesired results, including loss of file system availability." While I can imagine some kind of Rube Goldberg-esque chain of commands that I could run locally that would trigger the GPFS-filesystem-based commands I really want, I don't think mmaddcallback is the droid I'm looking for. Stephen R. Wall Buchanan Sr. IT Specialist IBM Data & AI North America Government Expert Labs +1 (571) 299-4601 stephen.buchanan@us.ibm.com ----- Original message ----- From: "Frederick Stock" <stockf@us.ibm.com> Sent by: gpfsug-discuss-bounces@spectrumscale.org To: gpfsug-discuss@spectrumscale.org Cc: gpfsug-discuss@spectrumscale.org Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem Date: Thu, Mar 14, 2019 4:17 PM It is not systemd based but you might want to look at the user callback feature in GPFS (mmaddcallback). There is a file system mount callback you could register. Fred __________________________________________________ Fred Stock | IBM Pittsburgh Lab | 720-430-8821 stockf@us.ibm.com ----- Original message ----- From: "Stephen R Buchanan" <stephen.buchanan@us.ibm.com> Sent by: gpfsug-discuss-bounces@spectrumscale.org To: gpfsug-discuss@spectrumscale.org Cc: Subject: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem Date: Thu, Mar 14, 2019 3:58 PM I searched the list archives with no obvious results. I have an application that runs completely from a Spectrum Scale filesystem that I would like to start automatically on boot, obviously after the SS filesystem mounts, on multiple nodes. There are groups of nodes for dev, test, and production, (separate clusters) and the target filesystems are different between them (and are named differently, so the paths are different), but all nodes have an identical soft link from root (/) that points to the environment-specific path. (see below for details) My first effort before I did any research was to try to simply use a directive of After=gpfs.service which anyone who has tried it will know that the gpfs.service returns as "started" far in advance (and independently of) when filesystems are actually mounted. What I want is to be able to deploy a systemd service-unit and path-unit pair of files (that are as close to identical as possible across the environments) that wait for /appbin/builds/ to be available (/[dev|tst|prd]01/ to be mounted) and then starts the application. The problem is that systemd.path units, specifically the 'PathExists=' directive, don't follow symbolic links, so I would need to customize the path unit file for each environment with the full (real) path. There are other differences between the environments that I believe I can handle by specifying an EnvironmentFile directive -- but that would come from the SS filesystem so as to be a single reference point, so it can't help with the path unit. Any suggestions are welcome and appreciated. dev:(path names have been slightly generalized, but the structure is identical) SS filesystem: /dev01 full path: /dev01/app-bin/user-tree/builds/ soft link: /appbin/ -> /dev01/app-bin/user-tree/ test: SS filesystem: /tst01 full path: /tst01/app-bin/user-tree/builds/ soft link: /appbin/ -> /tst01/app-bin/user-tree/ prod: SS filesystem: /prd01 full path: /prd01/app-bin/user-tree/builds/ soft link: /appbin/ -> /prd01/app-bin/user-tree/ Stephen R. Wall Buchanan Sr. IT Specialist IBM Data & AI North America Government Expert Labs +1 (571) 299-4601 stephen.buchanan@us.ibm.com _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
I also for using callbacks ( as that's the "right" way for GPFS to report an event) instead of polling for status. One exception is the umount case, in which when using bind mounts ( which is quite common for "namespace virtualization") one should use the preunmount user exit instead of callback ( callback wouldn't work on these cases) for more info check https://www.ibm.com/developerworks/community/wikis/home?lang=en-gb#!/wiki/Ge... Regards, Tomer Perry Scalable I/O Development (Spectrum Scale) email: tomp@il.ibm.com 1 Azrieli Center, Tel Aviv 67021, Israel Global Tel: +1 720 3422758 Israel Tel: +972 3 9188625 Mobile: +972 52 2554625 From: Simon Thompson <S.J.Thompson@bham.ac.uk> To: gpfsug main discussion list <gpfsug-discuss@spectrumscale.org> Date: 15/03/2019 10:53 Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem Sent by: gpfsug-discuss-bounces@spectrumscale.org +1 for using callbacks, we use the Mount and preUnMount callbacks on various things, e.g. before unmount, shutdown all the VMs running on the host, i.e. start and stop other things cleanly when the FS arrives/before it goes away. Simon From: <gpfsug-discuss-bounces@spectrumscale.org> on behalf of "stockf@us.ibm.com" <stockf@us.ibm.com> Reply-To: "gpfsug-discuss@spectrumscale.org" <gpfsug-discuss@spectrumscale.org> Date: Thursday, 14 March 2019 at 21:04 To: "gpfsug-discuss@spectrumscale.org" <gpfsug-discuss@spectrumscale.org> Cc: "gpfsug-discuss@spectrumscale.org" <gpfsug-discuss@spectrumscale.org> Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem But if all you are waiting for is the mount to occur the invocation of the callback informs you the file system has been mounted. You would be free to start a command in the background, with appropriate protection, and exit the callback script. Also, making the callback script run asynchronous means GPFS will not wait for it to complete and that greatly mitigates any potential problems with GPFS commands, if you need to run them from the script. Fred __________________________________________________ Fred Stock | IBM Pittsburgh Lab | 720-430-8821 stockf@us.ibm.com ----- Original message ----- From: "Stephen R Buchanan" <stephen.buchanan@us.ibm.com> Sent by: gpfsug-discuss-bounces@spectrumscale.org To: gpfsug-discuss@spectrumscale.org Cc: Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem Date: Thu, Mar 14, 2019 4:52 PM The man page for mmaddcallback specifically cautions against running "commands that involve GPFS files" because it "may cause unexpected and undesired results, including loss of file system availability." While I can imagine some kind of Rube Goldberg-esque chain of commands that I could run locally that would trigger the GPFS-filesystem-based commands I really want, I don't think mmaddcallback is the droid I'm looking for. Stephen R. Wall Buchanan Sr. IT Specialist IBM Data & AI North America Government Expert Labs +1 (571) 299-4601 stephen.buchanan@us.ibm.com ----- Original message ----- From: "Frederick Stock" <stockf@us.ibm.com> Sent by: gpfsug-discuss-bounces@spectrumscale.org To: gpfsug-discuss@spectrumscale.org Cc: gpfsug-discuss@spectrumscale.org Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem Date: Thu, Mar 14, 2019 4:17 PM It is not systemd based but you might want to look at the user callback feature in GPFS (mmaddcallback). There is a file system mount callback you could register. Fred __________________________________________________ Fred Stock | IBM Pittsburgh Lab | 720-430-8821 stockf@us.ibm.com ----- Original message ----- From: "Stephen R Buchanan" <stephen.buchanan@us.ibm.com> Sent by: gpfsug-discuss-bounces@spectrumscale.org To: gpfsug-discuss@spectrumscale.org Cc: Subject: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem Date: Thu, Mar 14, 2019 3:58 PM I searched the list archives with no obvious results. I have an application that runs completely from a Spectrum Scale filesystem that I would like to start automatically on boot, obviously after the SS filesystem mounts, on multiple nodes. There are groups of nodes for dev, test, and production, (separate clusters) and the target filesystems are different between them (and are named differently, so the paths are different), but all nodes have an identical soft link from root (/) that points to the environment-specific path. (see below for details) My first effort before I did any research was to try to simply use a directive of After=gpfs.service which anyone who has tried it will know that the gpfs.service returns as "started" far in advance (and independently of) when filesystems are actually mounted. What I want is to be able to deploy a systemd service-unit and path-unit pair of files (that are as close to identical as possible across the environments) that wait for /appbin/builds/ to be available (/[dev|tst|prd]01/ to be mounted) and then starts the application. The problem is that systemd.path units, specifically the 'PathExists=' directive, don't follow symbolic links, so I would need to customize the path unit file for each environment with the full (real) path. There are other differences between the environments that I believe I can handle by specifying an EnvironmentFile directive -- but that would come from the SS filesystem so as to be a single reference point, so it can't help with the path unit. Any suggestions are welcome and appreciated. dev:(path names have been slightly generalized, but the structure is identical) SS filesystem: /dev01 full path: /dev01/app-bin/user-tree/builds/ soft link: /appbin/ -> /dev01/app-bin/user-tree/ test: SS filesystem: /tst01 full path: /tst01/app-bin/user-tree/builds/ soft link: /appbin/ -> /tst01/app-bin/user-tree/ prod: SS filesystem: /prd01 full path: /prd01/app-bin/user-tree/builds/ soft link: /appbin/ -> /prd01/app-bin/user-tree/ Stephen R. Wall Buchanan Sr. IT Specialist IBM Data & AI North America Government Expert Labs +1 (571) 299-4601 stephen.buchanan@us.ibm.com _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org https://urldefense.proofpoint.com/v2/url?u=http-3A__gpfsug.org_mailman_listi...
I use the following: [Unit] Description=Foo After=gpfs.service [Service] ExecStartPre=/bin/bash -c 'until [ -d /gpfs/%I/apps/services/foo ]; do sleep 20s; done' ExecStart=/usr/sbin/runuser -u root /gpfs/%I/apps/services/foo/bin/runme [Install] WantedBy=multi-user.target Then I can drop it on multiple systems (with the same app layout), and run: systemctl enable foo@fs1 or systemctl enable foo@fs2 The "%I" gets replaced by what is after that "@". -- Tyler Trafford tyler.trafford@yale.edu ________________________________________ From: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> on behalf of Stephen R Buchanan <stephen.buchanan@us.ibm.com> Sent: Thursday, March 14, 2019 3:58 PM To: gpfsug-discuss@spectrumscale.org Subject: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem I searched the list archives with no obvious results. I have an application that runs completely from a Spectrum Scale filesystem that I would like to start automatically on boot, obviously after the SS filesystem mounts, on multiple nodes. There are groups of nodes for dev, test, and production, (separate clusters) and the target filesystems are different between them (and are named differently, so the paths are different), but all nodes have an identical soft link from root (/) that points to the environment-specific path. (see below for details) My first effort before I did any research was to try to simply use a directive of After=gpfs.service which anyone who has tried it will know that the gpfs.service returns as "started" far in advance (and independently of) when filesystems are actually mounted. What I want is to be able to deploy a systemd service-unit and path-unit pair of files (that are as close to identical as possible across the environments) that wait for /appbin/builds/ to be available (/[dev|tst|prd]01/ to be mounted) and then starts the application. The problem is that systemd.path units, specifically the 'PathExists=' directive, don't follow symbolic links, so I would need to customize the path unit file for each environment with the full (real) path. There are other differences between the environments that I believe I can handle by specifying an EnvironmentFile directive -- but that would come from the SS filesystem so as to be a single reference point, so it can't help with the path unit. Any suggestions are welcome and appreciated. dev:(path names have been slightly generalized, but the structure is identical) SS filesystem: /dev01 full path: /dev01/app-bin/user-tree/builds/ soft link: /appbin/ -> /dev01/app-bin/user-tree/ test: SS filesystem: /tst01 full path: /tst01/app-bin/user-tree/builds/ soft link: /appbin/ -> /tst01/app-bin/user-tree/ prod: SS filesystem: /prd01 full path: /prd01/app-bin/user-tree/builds/ soft link: /appbin/ -> /prd01/app-bin/user-tree/ Stephen R. Wall Buchanan Sr. IT Specialist IBM Data & AI North America Government Expert Labs +1 (571) 299-4601 stephen.buchanan@us.ibm.com
I forgot to mention that you need to name the unit file something like foo@.service -Tyler ________________________________________ From: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> on behalf of Trafford, Tyler <tyler.trafford@yale.edu> Sent: Thursday, March 14, 2019 5:36 PM To: gpfsug main discussion list Subject: Re: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem I use the following: [Unit] Description=Foo After=gpfs.service [Service] ExecStartPre=/bin/bash -c 'until [ -d /gpfs/%I/apps/services/foo ]; do sleep 20s; done' ExecStart=/usr/sbin/runuser -u root /gpfs/%I/apps/services/foo/bin/runme [Install] WantedBy=multi-user.target Then I can drop it on multiple systems (with the same app layout), and run: systemctl enable foo@fs1 or systemctl enable foo@fs2 The "%I" gets replaced by what is after that "@". -- Tyler Trafford tyler.trafford@yale.edu ________________________________________ From: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> on behalf of Stephen R Buchanan <stephen.buchanan@us.ibm.com> Sent: Thursday, March 14, 2019 3:58 PM To: gpfsug-discuss@spectrumscale.org Subject: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem I searched the list archives with no obvious results. I have an application that runs completely from a Spectrum Scale filesystem that I would like to start automatically on boot, obviously after the SS filesystem mounts, on multiple nodes. There are groups of nodes for dev, test, and production, (separate clusters) and the target filesystems are different between them (and are named differently, so the paths are different), but all nodes have an identical soft link from root (/) that points to the environment-specific path. (see below for details) My first effort before I did any research was to try to simply use a directive of After=gpfs.service which anyone who has tried it will know that the gpfs.service returns as "started" far in advance (and independently of) when filesystems are actually mounted. What I want is to be able to deploy a systemd service-unit and path-unit pair of files (that are as close to identical as possible across the environments) that wait for /appbin/builds/ to be available (/[dev|tst|prd]01/ to be mounted) and then starts the application. The problem is that systemd.path units, specifically the 'PathExists=' directive, don't follow symbolic links, so I would need to customize the path unit file for each environment with the full (real) path. There are other differences between the environments that I believe I can handle by specifying an EnvironmentFile directive -- but that would come from the SS filesystem so as to be a single reference point, so it can't help with the path unit. Any suggestions are welcome and appreciated. dev:(path names have been slightly generalized, but the structure is identical) SS filesystem: /dev01 full path: /dev01/app-bin/user-tree/builds/ soft link: /appbin/ -> /dev01/app-bin/user-tree/ test: SS filesystem: /tst01 full path: /tst01/app-bin/user-tree/builds/ soft link: /appbin/ -> /tst01/app-bin/user-tree/ prod: SS filesystem: /prd01 full path: /prd01/app-bin/user-tree/builds/ soft link: /appbin/ -> /prd01/app-bin/user-tree/ Stephen R. Wall Buchanan Sr. IT Specialist IBM Data & AI North America Government Expert Labs +1 (571) 299-4601 stephen.buchanan@us.ibm.com _______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgpfsug.org%2Fmailman%2Flistinfo%2Fgpfsug-discuss&data=02%7C01%7Ctyler.trafford%40yale.edu%7Cb3be6639c012419aaf3908d6a8c518c9%7Cdd8cbebb21394df8b4114e3e87abeb5c%7C0%7C0%7C636881961822668372&sdata=4rU%2BWIv1tpJiTOGmliWba2vvTxeJf5gYyJ7xrbdf6wE%3D&reserved=0
+1 — This is the best solution. The only thing I would change would be to add: TimeoutStartSec=300 Or something similar. This leaves the maintenance of starting applications where it belongs (in systems, not in GPFS). You can use the same technique for other VFS types (like NFS if you needed). You can check for any file on the file system you want, so you could just put a dotfile in the root of each waited-for file system and look for that. You an even chase your symlink if you want (removing the parameter completely). As a recovering sysadmin, this makes me smile. -- Stephen
On Mar 14, 2019, at 5:36 PM, Trafford, Tyler <tyler.trafford@yale.edu> wrote:
I use the following:
[Unit] Description=Foo After=gpfs.service
[Service] ExecStartPre=/bin/bash -c 'until [ -d /gpfs/%I/apps/services/foo ]; do sleep 20s; done' ExecStart=/usr/sbin/runuser -u root /gpfs/%I/apps/services/foo/bin/runme
[Install] WantedBy=multi-user.target
Then I can drop it on multiple systems (with the same app layout), and run:
systemctl enable foo@fs1 or systemctl enable foo@fs2
The "%I" gets replaced by what is after that "@".
-- Tyler Trafford tyler.trafford@yale.edu
________________________________________ From: gpfsug-discuss-bounces@spectrumscale.org <gpfsug-discuss-bounces@spectrumscale.org> on behalf of Stephen R Buchanan <stephen.buchanan@us.ibm.com> Sent: Thursday, March 14, 2019 3:58 PM To: gpfsug-discuss@spectrumscale.org Subject: [gpfsug-discuss] Systemd configuration to wait for mount of SS filesystem
I searched the list archives with no obvious results.
I have an application that runs completely from a Spectrum Scale filesystem that I would like to start automatically on boot, obviously after the SS filesystem mounts, on multiple nodes. There are groups of nodes for dev, test, and production, (separate clusters) and the target filesystems are different between them (and are named differently, so the paths are different), but all nodes have an identical soft link from root (/) that points to the environment-specific path. (see below for details)
My first effort before I did any research was to try to simply use a directive of After=gpfs.service which anyone who has tried it will know that the gpfs.service returns as "started" far in advance (and independently of) when filesystems are actually mounted.
What I want is to be able to deploy a systemd service-unit and path-unit pair of files (that are as close to identical as possible across the environments) that wait for /appbin/builds/ to be available (/[dev|tst|prd]01/ to be mounted) and then starts the application. The problem is that systemd.path units, specifically the 'PathExists=' directive, don't follow symbolic links, so I would need to customize the path unit file for each environment with the full (real) path. There are other differences between the environments that I believe I can handle by specifying an EnvironmentFile directive -- but that would come from the SS filesystem so as to be a single reference point, so it can't help with the path unit.
Any suggestions are welcome and appreciated.
dev:(path names have been slightly generalized, but the structure is identical) SS filesystem: /dev01 full path: /dev01/app-bin/user-tree/builds/ soft link: /appbin/ -> /dev01/app-bin/user-tree/
test: SS filesystem: /tst01 full path: /tst01/app-bin/user-tree/builds/ soft link: /appbin/ -> /tst01/app-bin/user-tree/
prod: SS filesystem: /prd01 full path: /prd01/app-bin/user-tree/builds/ soft link: /appbin/ -> /prd01/app-bin/user-tree/
Stephen R. Wall Buchanan Sr. IT Specialist IBM Data & AI North America Government Expert Labs +1 (571) 299-4601 stephen.buchanan@us.ibm.com
_______________________________________________ gpfsug-discuss mailing list gpfsug-discuss at spectrumscale.org http://gpfsug.org/mailman/listinfo/gpfsug-discuss
participants (8)
-
Bryan Banister -
Frederick Stock -
Marc A Kaplan -
Simon Thompson -
Stephen R Buchanan -
Stephen Ulmer -
Tomer Perry -
Trafford, Tyler
