Upgrade emoncms via ssh

Good morning,

I would like to update my emonbase (Raspberry 4) to the latest version of emoncms via ssh. It’s possible ?

Thank you

Hello @michelino yes you can run the command that is usually run from the UI manually:

/opt/openenergymonitor/EmonScripts/update/service-runner-update.sh all

It’s also possible to do a selective update e.g:

Emoncms only:

/opt/openenergymonitor/EmonScripts/update/service-runner-update.sh emoncms

Emonhub only:

/opt/openenergymonitor/EmonScripts/update/service-runner-update.sh emonhub
1 Like

One for the docs…

Thanks Trystan,
let me start by saying that I have 2 servers, one master and one slave.

I mainly use mariadb as a database for convenience as I also query the database with external functions.

Before updating the main server I wanted to update the slave with the latest version of emoncms. The current emoncms version of slave is 11.0.9

my configuration is

root@emoncmsServerBck:~# df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/root      960273136 17156252 894264012   2% /
devtmpfs         3735680        0   3735680   0% /dev
tmpfs            3999904        0   3999904   0% /dev/shm
tmpfs            1599964     2088   1597876   1% /run
tmpfs               5120        4      5116   1% /run/lock
/dev/mmcblk0p1    261108    51634    209474  20% /boot
tmpfs             799980        0    799980   0% /run/user/0
root@emoncmsServerBck:~#

root@emoncmsServerBck:~# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk
└─sda1        8:1    0 931.5G  0 part /
mmcblk0     179:0    0   7.5G  0 disk
├─mmcblk0p1 179:1    0   256M  0 part /boot
└─mmcblk0p2 179:2    0   7.2G  0 part
root@emoncmsServerBck:~#

root@emoncmsServerBck:~# /opt/openenergymonitor/EmonScripts/update/service-runner-update.sh emonhub
Starting update via service-runner-update.sh (v3.0) >
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       916G   17G  853G   2% /
devtmpfs        3.6G     0  3.6G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           1.6G  2.1M  1.6G   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/mmcblk0p1  255M   51M  205M  20% /boot
tmpfs           782M     0  782M   0% /run/user/0
- emonSD version: emonSD-02Oct19
- supported images: emonSD-01Feb24 emonSD-20Nov23 emonSD-10Nov22 emonSD-21Jul21 emonSD-08May21 emonSD-24Jul20 emonSD-02Oct19 emonSD-17Oct19
- emonSD base image check passed...continue update
git pull /opt/openenergymonitor/EmonScripts
  master
* stable
On branch stable
Your branch is up to date with 'origin/stable'.

nothing to commit, working tree clean
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
Already up to date.
-------------------------------------------------------------
Main Update Script
-------------------------------------------------------------
Date: Wed 10 Jul 18:46:38 CEST 2024
EUID: 0
openenergymonitor_dir: /opt/openenergymonitor
type: emonhub
serial_port: ttyAMA0
firmware: emonPi_discrete_jeelib
update running as root, switch to user

[Edited for presentation - Moderator (RW)]

For future reference, when posting code or output, please put 3 ‘backticks’ (normally found at the top left of the keyboard) on a line of their own before the code, and 3 more backticks also on a line of their own after the code:

```
code
```

If it is something like php you can add a language identifier after the first 3 backticks: ```php or even ```text if you don’t want any language markup applied.

Hello @michelino

Looks like you are running the script as root, which is giving the error that you are seeing when running the script. Can you run the script as the pi user?