Skip to content

Commit ef94e35

Browse files
committed
modified: pages/docs/user-docs/docs-instances.md
1 parent e614168 commit ef94e35

1 file changed

Lines changed: 33 additions & 2 deletions

File tree

pages/docs/user-docs/docs-instances.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,42 @@ With version 2.4, you can do this in a more realistic way. First, let's put the
3232
service nginx start
3333
```
3434

35-
and we will pretend that we are running with sudo, and we don't specify it above. Now let's say we have a container called `nginx.img` and we want to run it! What do we do?
35+
and an instruction to stop it too:
36+
37+
38+
```
39+
%startscript
40+
41+
service nginx stop
42+
```
43+
44+
You might even have some special (longer set) of commands in your startscript, if warranted:
45+
46+
```
47+
#!/bin/sh
48+
49+
if [ -z "$OMGTACOSGUNICORN" ]; then
50+
/bin/bash /code/helpers/ctrl/gunicorn.screen
51+
echo "server started, status code $?"
52+
else
53+
echo "server is already running. Use restart or stop."
54+
fi
55+
56+
if [ -z "$OMGTACOSCELERY" ]; then
57+
/bin/bash /code/helpers/ctrl/celery.screen
58+
echo "worker started, status code $?"
59+
else
60+
echo "worker is already running. Use restart or stop."
61+
fi
62+
```
63+
64+
In the above example, there are two services in my container, and based on environment varibles, there is some custom functionality that happens based on how the user sets them upon starting the container instance.
65+
66+
Now let's say we have a container called `nginx.img` and we want to run a service in it. What do we do? Well, first we clone it to make an instance:
3667

3768
```
3869
[action] [image] [name of instance]
39-
singularity clone nginx.img service
70+
singularity clone nginx.img instance
4071
```
4172

4273
When I do that, I still have my file `nginx.img` sitting on my Desktop, but now you can think about having actually an instance of it running, which I can now control! Heck, I could do that multiple times, if it made sense for my service:

0 commit comments

Comments
 (0)