<commit_before>+++
date = "2017-06-13T00:00:00Z"
lastmod = "2017-06-14T00:00:00Z"
title = "Replicated CLI Alias"
weight = "999999"
categories = [ "Knowledgebase", "Supporting Your Customers" ]
+++

The Replicated [Easy Install Scripts](https://www.replicated.com/docs/distributing-an-application/installing-via-script/) will automatically set up the [Replicated CLI V1](https://www.replicated.com/docs/reference/replicated-cli/) and [Replicated CLI V2](https://www.replicated.com/docs/reference/replicatedctl/) aliases. However, if your customer has upgraded from Replicated version 2.8.2 to 2.9.0, then the Replicated CLI V2 alias is not automatically available. Likewise, if your customer performed a [manual installation](https://www.replicated.com/docs/distributing-an-application/installing-manually/), then neither Replicated CLI versions will be available as an alias.

Depending on your scheduler, run the following shell scripts as `sudo` to set up the Replicated CLI V1 and V2 alias on Replicated installations.

_Please note that the customer will have to hit enter after the last command._

### Replicated Scheduler

```shell
cat > /usr/local/bin/replicated <<-EOF
#!/bin/sh

# test if stdout is a terminal
if [ -t 1 ]; then
sudo docker exec -it replicated replicated "\$@"
else
sudo docker exec replicated replicated "\$@"
fi
EOF
chmod a+x /usr/local/bin/replicated
cat > /usr/local/bin/replicatedctl <<-EOF
#!/bin/sh

# test if stdout is a terminal
if [ -t 1 ]; then
sudo docker exec -it replicated replicatedctl "\$@"
else
sudo docker exec replicated replicatedctl "\$@"
fi
EOF
chmod a+x /usr/local/bin/replicatedctl
```

### Swarm Scheduler
<commit_msg>Create cli-alias.md<commit_after>+++
date = "2017-06-13T00:00:00Z"
lastmod = "2017-06-14T00:00:00Z"
title = "Replicated CLI Alias"
weight = "999999"
categories = [ "Knowledgebase", "Supporting Your Customers" ]
+++

The Replicated [easy install script](https://www.replicated.com/docs/distributing-an-application/installing-via-script/) will automatically set up the [`replicated` CLI](https://www.replicated.com/docs/reference/replicated-cli/) and [`replicatedctl` CLI](https://www.replicated.com/docs/reference/replicatedctl/) aliases. However, if a serveris automatically upgraded from an version before 2.9.0, then the `replicatedctl` alias will not be automatically installed. Likewise, if your customer performed a [manual installation](https://www.replicated.com/docs/distributing-an-application/installing-manually/), then neither Replicated CLI versions will be available as an alias.

Depending on the scheduler Replicated is running with, run the following shell scripts as `sudo` to set up the `replicated` and `replicatedctl` aliases:

### Replicated Scheduler

```shell
cat > /usr/local/bin/replicated <<-EOF
#!/bin/sh

# test if stdout is a terminal
if [ -t 1 ]; then
sudo docker exec -it replicated replicated "\$@"
else
sudo docker exec replicated replicated "\$@"
fi
EOF
chmod a+x /usr/local/bin/replicated
cat > /usr/local/bin/replicatedctl <<-EOF
#!/bin/sh

# test if stdout is a terminal
if [ -t 1 ]; then
sudo docker exec -it replicated replicatedctl "\$@"
else
sudo docker exec replicated replicatedctl "\$@"
fi
EOF
chmod a+x /usr/local/bin/replicatedctl
```

### Swarm Scheduler

{'fraction_non_alphanumeric': 0.11949877750611247, 'fraction_numerical': 0.02628361858190709, 'mean_word_length': 4.762323943661972, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 8, 'lorem ipsum': 0, 'www.': 8, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2393573', 'n_tokens_mistral': 1109, 'n_tokens_neox': 986, 'n_words': 342}